Linux 命令排列和命令替換
命令的排列
在一行中給出多個命令時
1、command1 ; command2
先執行command1,不管對錯,接下來執行command2
例如:ls -a ; du -hs
將先輸出目錄所有內容,然後列出所有目錄及其子目錄所佔磁碟大小。
2、command1 && command2
只有當command1正確執行完畢後,才執行command2
例如:ls -a baodir && du -hs
將返回ls:baodir:no such file or directory,而du根本沒執行。
3、command1 || command2
若command1 執行不成功,則執行command2,
反之,
若command1 執行成功,則不執行command2
命令的替換
1、command1 $(command2)
2、command1 'command2'
將command2的輸出作為command1後的引數。
例如:less $(locate redme.txt) locate的輸出作為less的引數,然後直接顯示。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23682146/viewspace-1055543/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linuxvivim查詢和替換字串命令Linux字串
- Linux sed 命令字串替換使用方法詳解Linux字串
- linux命令大全-linux命令使用和管理Linux
- vim下多行查詢替換簡單命令
- linux中file命令和find命令Linux
- Linux系統中的管道命令、grep命令、sed命令和awk命令Linux
- linux命令大全-linux命令使用和管理視訊教程Linux
- Linux 引數代換 命令 xargsLinux
- linux文字替換Linux
- 【linux命令】setfacl和getfaclLinux
- 使用 sed 命令查詢和替換檔案中的字串的 16 個示例字串
- 使用sed 命令查詢和替換檔案中的字串的方法總結字串
- 【Linux命令】grep命令Linux
- Linux命令—–CP命令Linux
- Linux命令分享- 新建使用者和組命令Linux
- 每天三分半鐘搞定linux基礎知識(19) echo命令實現字串的擷取和替換Linux字串
- Linux vi替換字串Linux字串
- Linux命令和開發工具Linux
- Linux中dir和dirname命令Linux
- Linux命令(1)——xargs命令Linux
- Linux命令之lldptool命令Linux
- Linux命令篇 - sed 命令Linux
- Linux命令篇 - grep 命令Linux
- Linux命令篇 - tar 命令Linux
- Linux命令之rz命令與sz命令Linux
- Linux基礎命令—文字格式轉換fmtLinux
- Linux基礎命令---文字格式轉換fmtLinux
- Linux基礎命令—格式轉換expand、unexpandLinux
- 在 Linux 命令列中轉換大小寫Linux命令列
- linux關閉防火牆命令 linux防火牆關閉和開啟命令Linux防火牆
- Linux中內部命令和外部命令如何區分?Linux
- Linux命令Linux
- linux每日命令(5):mkdir命令Linux
- linux-mysql命令,tomcat命令LinuxMySqlTomcat
- linux每日命令(2):cd命令Linux
- linux每日命令(18):whereis命令Linux
- linux每日命令(12):nl命令Linux
- linux每日命令(10):touch命令Linux
- linux每日命令(11):cat命令Linux