Bash 是brian Fox在1988年1月10號出于Richard Stallman的建議而寫的。
一、 運行模板:
二、操作快捷鍵:
Ctrl+a:移動光標到行起始位置。
Ctrl+e:移動光標到行末位置。
Alt+f:以詞形式向前移動光標
Alt+b:以詞形式向后移動光標
Ctrl+c: 對當前任務發出SIGINT信號,使其中止并退出。
Ctrl+z:對在foreground任務發送信號SIGTSTP讓其暫停。
Tab:自動補全
Ctrl+k:刪除光標之后字符,并拷貝到clipboard中。
Ctrl+u:刪除光標之前字符,并拷貝到clipboard中。
Ctrl+y:拷貝clipboard的內容插入光標位置
Ctrl+_:回退修改。
Ctrl+t:交換光標之前的兩個字符。
三、 執行模型:
Shell 執行環境是一個劇場,劇場有舞臺(foreground)和后臺(background),有許多劇目(task)可以在舞臺上表演,舞臺上只有一個劇目(fg task)在被人欣賞,其它劇目在后臺排演(bg task),直到用戶想看到它并替換當前劇目(fg,bg指令)。
2. 規則:
3. 困惑:
完成一件工作執行的命令比較多,一條一條敲沒完沒了?可以把命令合在一起寫成一個腳本文件來執行。
四、 腳本語法
2. Quoting:有expanish就有quoting.quoting有三種:
Cron(一個執行計劃任務的服務)的啟動文件
/etc/init.d/crond
1: #! /bin/bash
2: #
3: # crond Start/Stop the cron clock daemon.
4: #
5: # chkconfig: 2345 90 60
6: # description: cron is a standard UNIX program that runs user-specified /
7: # programs at periodic scheduled times. vixie cron adds a /
8: # number of features to the basic UNIX cron, including better /
9: # security and more powerful configuration options.
10: # processname: crond
11: # config: /etc/crontab
12: # pidfile: /var/run/crond.pid
13:
14: # Source function library.
15: . /etc/init.d/functions
16: . /etc/sysconfig/crond
17: t=${CRON_VALIDATE_MAILRCPTS:-UNSET}
18: [ "$t" != "UNSET" ] &;& export CRON_VALIDATE_MAILRCPTS="$t"
19:
20: # See how we were called.
21:
22: prog="crond"
23:
24: start() {
25: echo -n $"Starting $prog: "
26: if [ -e /var/lock/subsys/crond ]; then
27: if [ -e /var/run/crond.pid ] &;& [ -e /proc/`cat /var/run/crond.pid` ]; then
28: echo -n $"cannot start crond: crond is already running.";
29: failure $"cannot start crond: crond already running.";
30: echo
31: return 1
32: fi
33: fi
34: daemon crond $CRONDARGS
35: RETVAL=$?
36: echo
37: [ $RETVAL -eq 0 ] &;& touch /var/lock/subsys/crond;
38: return $RETVAL
39: }
if( “$t”!=”UNSET”)
export CRON_VALIDATE_MAILRCPTS="$t"
“”表示一種quote,里面允許執行prameter expanision.將t的值替換 $t.
新聞熱點
疑難解答