Shell学习第一章:linux快速介绍
程序员文章站
2024-02-24 12:15:59
...
参考文献:https://bash.cyberciti.biz/guide/Main_Page Linux Shell Scripting
第一章 Quick introduction to linux
1、输入下面指令,查看自己的系统中支持的shell
cat /etc/shell
2、linux下的帮助手册man命令和info命令
man date
info ls
info man
man info
info date
3、linux下的很多命令都接受--help 或者-h为参数,试着输入下面的指令
date --help
通过下面的指令形式来获得linux下某一个命令的帮助文档
man commandName
info commandName
commandName -h
commandName --help
4、unix的一些设计哲学理念
1、Do one thing and do it well - Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.
2、Everything is file - Ease of use and security is offered by treating hardware as a file.
3、Small is beautiful.
4、Store data and configuration in flat text files - Text file is a universal interface. Easy to create, backup and move to another system.
5、Use shell scripts to increase leverage and portability - Use shell script to automate common tasks across various UNIX / Linux installations.
6、Chain programs together to complete complex task - Use shell pipes and filters to chain small utilities that perform one task at time.
7、Choose portability over efficiency.
8、Keep it Simple, Stupid (KISS).
5、shell Script 或shell scripting是什么?
通常来说,shell是交互式的,你输入一个命令和一些参数,然后shell开始执行;但当你将很多命令写入到一个文件中,然后告诉shell去执行这个文件,并不输入任何参数,这种方式就叫做shell script或者shell program。
6、shell script包含什么?
1、Shell keywords such as if..else, do..while.
2、Shell commands such as pwd, test, echo, continue, type.
3、Linux binary commands such as w, who, free etc..
4、Text processing utilities such as grep, awk, cut.
5、Functions - add frequent actions together via functions. For example, /etc/init.d/functions file contains functions to be used by most or all system shell scripts in the /etc/init.d directory.
6、Control flow statments such as if..then..else or shell loops to perform repeated actions.
7、每一个shell 都包含目的
Each script has purpose
1、Specific purpose - For example, backup file system and database to NAS server.
2、Act like a command - Each shell script is executed like any other command under Linux.
3、Script code usability - Shell scripts can be extended from existing scripts. Also, you can use functions files to package frequently used tasks.
8、为什么需要shell script?
shell脚本可以让你很方便地完成一些重复的工作,当你发现你一直在做一些重复的事情时,你应该写一个shell脚本,让它自动完成。
上一篇: Session cookie、持久化Cookie和P3P头在跨域访问时候的行为 博客分类: JavaScript Session cookie持久化CookieP3P头跨域访问
下一篇: linux下文本去重
推荐阅读
-
Shell学习第一章:linux快速介绍
-
学习shell咯1 博客分类: Linux LinuxBashUbuntuSolarisUnix
-
学习shell咯2 博客分类: Linux 编程GoCC++C#
-
学习shell咯3 博客分类: Linux Bash编程CC++C#
-
学习shell咯4 博客分类: Linux 正则表达式LinuxUnix
-
Shell入门学习 博客分类: Linux RubyBash
-
Shell入门学习 博客分类: Linux RubyBash
-
linux 中shell脚本的学习
-
linux学习日记九 正则表达式介绍
-
PHP 程序员要不要学习 Linux shell 编程?