码迷,mamicode.com
首页 > 系统相关 > 详细

Linux Bash Scripting - Command Chaining & Command lists

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

标签:linux

 # 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

标签:linux

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!