学会思考
刻意练习

ls | cat -n > out.txt 给输出的信息加行号并导出到out.txt

利用shell生成一个独立的进程

pwd;

(cd /bin; ls);

pwd;

开启一个子shell,不会影响到当前shell的路径;

 

1.从输入读取n个字符存入变量variable_name

read -n numer_of_chars variable_name

ex:

read -n 3 var 

echo $var

(2)用无回显的方式读取密码

read -s var 

(3)显示提示信息

read -p "enter input:" var

(4)在特定的时间内读取输入

read -t timeout var

ex:

read -t 2 var

(5)用特定的定界符作为输入行的结束

read -d delim_char var

ex:

read -d ":" var

重复执行命令函数:

repeat()

{

  while true

  do

    $@ && return

  done

}

或者放入shell的rc文件,便于使用:

repeat() {while true;do $@ && return; done}


repeat() {while :;do $@ && return; done}

修改间隔时间后再次执行,默认会不断执行:
repeat() {while :; do $@ && return ; sleep 30; done}

 

example:
  repeat wget-c http://www.example.com/software.tar.gz

 

posted on 2017-06-10 14:53  Worty  阅读(1490)  评论(0)    收藏  举报