摘要:
准备: script -t 2> timing.log -a output.session type commands; ... . .. exit 回放: scriptreplay timing.log output.session 阅读全文
posted @ 2017-06-10 21:10
Worty
阅读(254)
评论(0)
推荐(0)
摘要:
cat是单词concatenate缩写 echo 'text through stdin' | cat - file.txt 输出:text throgh stdin 和file.txt中的内容; cat -s file:压缩空白行 cat -T file:标记处文件中所有的制表符为^| cat - 阅读全文
posted @ 2017-06-10 17:46
Worty
阅读(753)
评论(0)
推荐(0)
摘要:
for循环 for var in list; do commands;#使用变量$var done example: for i in {a..z}; do actions; done; 后者 for((i=0;i<10;i++)) { commands; } while condition do 阅读全文
posted @ 2017-06-10 15:40
Worty
阅读(523)
评论(0)
推荐(0)
摘要:
设置IFS为,号分隔符 注意:[ ]空格; 阅读全文
posted @ 2017-06-10 15:30
Worty
阅读(533)
评论(0)
推荐(0)
摘要:
ls | cat -n > out.txt 给输出的信息加行号并导出到out.txt 利用shell生成一个独立的进程 pwd; (cd /bin; ls); pwd; 开启一个子shell,不会影响到当前shell的路径; 1.从输入读取n个字符存入变量variable_name read -n 阅读全文
posted @ 2017-06-10 14:53
Worty
阅读(1490)
评论(0)
推荐(0)
摘要:
定义函数 function fname() { statements; } 或者 fname() { statements; } 传递参数给函数: fname arg1 arg2; ex: 函数参数定义: fname() { echo $1, $2; echo "$@"; echo "$*"; re 阅读全文
posted @ 2017-06-10 14:15
Worty
阅读(224)
评论(0)
推荐(0)
摘要:
1.使用-x,开启shell脚本的跟踪调试功能 ex:bash -x script.sh or sh -x script.sh 2.使用set -x 和 set +x对脚本进行部分调试(输入中间的内容) 3.固定格式生成调试信息 注:符号:告诉shell不要进行任何操作 执行命令:_DEBUG=on 阅读全文
posted @ 2017-06-10 11:12
Worty
阅读(181)
评论(0)
推荐(0)
摘要:
#!/bin/bash #filename.sh echo -n Count: tput sc count=0; while true; do if [ $count -lt 40 ]; then let count++; sleep 1; tput rc; tput ed; echo -n $c... 阅读全文
posted @ 2017-06-10 10:31
Worty
阅读(2327)
评论(0)
推荐(0)
浙公网安备 33010602011771号