首页 > 系统服务 > 详细

Linux Bash Scripting - Command Chaining & Command lists

时间:2017-07-16 17:16:42      阅读:325      评论:0      收藏:0      [点我收藏+]

 # this is to show you how to execute a series of commands in one strike.


 $ clear; cd /; ls -l; echo "You are in $PWD"; echo "Time to go back home"; cd ~;


# use semi colon between each command.


# There is also command lists, which is for a different logic


## double ampersand means ANDING, double pipe means ORING; when using &&, only when the first command exits 0 (successful), the later command will be proceeded; when using ||, if the first command exits none zero (not successful), the later command will be proceeded;


$ ls -l && you are in $PWD, you were in $OLDPWD


$ ls -z || you are in $PWD

Linux Bash Scripting - Command Chaining & Command lists

原文:http://blade20.blog.51cto.com/7928919/1947991

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!