Linux Bash Scripting - Command Chaining & Command lists
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Bash Scripting - Command Chaining & Command lists相关的知识,希望对你有一定的参考价值。
# 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的主要内容,如果未能解决你的问题,请参考以下文章
[Bash Scripting LOOP]for, while. until
[Bash Scripting LOOP]for, while. until
编程实践Bash Scripting with ChatGPT: Highlight Syntax使用 ChatGPT 编写 Bash 脚本:突出显示语法