变量名、转义符等,一般用双引号括起来.缺省情况下echo不解释STRING中的转义符,加上-e 才可,缺省情况,echo 自动输出NEWLINE,加上-n 不输出换行符NEWLINE. [root@windriver-machine shtest]# echo "\007you home is $HOME,you are connected on `tty`" \007you home is /root,you are connected on /dev/pts/0 [root@windriver-machine shtest]# echo -e "\007you home is $HOME,you are connected on `tty`" you home is /root,you are connected on /dev/pts/0 [root@windriver-machine shtest]# echo Hello world Hello world [root@windriver-machine shtest]# echo "Hello world" Hello world [root@windriver-machine shtest]# w 22:36:57 up 87 days, 23:16, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT windrive pts/0 :2.0 Sat19 1.00s 0.28s 6.56s gnome-terminal [root@windriver-machine shtest]# echo -e "Here is a tab\there are two tabs\t\tOK" Here is a tab here are two tabs OK [root@windriver-machine shtest]# echo "\"/dev/rmt0\"" "/dev/rmt0" [root@windriver-machine shtest]# echo "The log files have all been done" >myfile [root@windriver-machine shtest]# cat myfile The log files have all been done [root@windriver-machine shtest]# 【2】read 可以使用read语句从键盘或者文件中的某一行文本中读入信息,并将其赋给一个变量. [root@windriver-machine shtest]# read -p "How old r u" age How old r u32 [root@windriver-machine shtest]# echo $age 32 [root@windriver-machine shtest]# read -p "some words?" -a words some words?I am a boy [root@windriver-machine shtest]# echo ${word[*]} [root@windriver-machine shtest]# echo ${words[*]} I am a boy [root@windriver-machine shtest]# read -p "Passowrd:" -s passwd Passowrd:[root@windriver-machine shtest]# echo $passwd teetesetbpadasdf [root@windriver-machine shtest]# read -n -bash: read: -n: option requires an argument read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n nchars] [-d delim] [name ...] [root@windriver-machine shtest]# read -t 5 auth sdfasdfas [root@windriver-machine shtest]# echo $auth sdfasdfas [root@windriver-machine shtest]# read -n 1 key 1[root@windriver-machine shtest]# [root@windriver-machine shtest]# echo $key 1 [root@windriver-machine shtest]# read -dq -p "imput something end with q:" menu imput something end with q:wobiq[root@windriver-machine shtest]# echo $menu wobi [root@windriver-machine shtest]# read -e myfile hello [root@windriver-machine shtest]# cat myfile The log files have all been done [root@windriver-machine shtest]# read -e myfile ll [root@windriver-machine shtest]# read -e myfile testfile [root@windriver-machine shtest]# 【3】cat 显示文件内容,它显示内容与more和head命令不同,它不会分页显示,而是全 |