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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux 下一個替換命令Linux
- vi替換命令
- Linuxvivim查詢和替換字串命令Linux字串
- Linux Shell程式設計(24)——命令替換Linux程式設計
- vim全域性替換命令
- vim替換命令 (語法)
- vi 替換命令引數
- vi的替換命令說明
- perl命令:批量修改替換檔案
- vi查詢替換命令詳解
- Linux sed 命令字串替換使用方法詳解Linux字串
- vim下多行查詢替換簡單命令
- linux命令大全-linux命令使用和管理Linux
- Shell 中的命令替換及引數擴充套件套件
- linux圖形介面和命令列介面切換Linux命令列
- linux中file命令和find命令Linux
- 使用sed 命令查詢和替換檔案中的字串的方法總結字串
- 使用 sed 命令查詢和替換檔案中的字串的 16 個示例字串
- linux文字替換Linux
- Linux 引數代換 命令 xargsLinux
- linux命令列大小寫轉換Linux命令列
- Linux su命令和sudo命令的區別Linux
- <linux下內建命令和外部命令>Linux
- Linux cp命令和scp命令使用詳解Linux
- oracle 11g 中 (oracle 10g) crsctl 的 替換命令Oracle 10g
- linux命令大全-linux命令使用和管理視訊教程Linux
- 每天三分半鐘搞定linux基礎知識(19) echo命令實現字串的擷取和替換Linux字串
- Linux vi替換字串Linux字串
- Linux命令分享- 新建使用者和組命令Linux
- linux find 命令和 while 命令聯合使用案例LinuxWhile
- Linux Shell命令換行問題(轉)Linux
- 詳解 packagit 用了什麼黑魔法,並可完全替換 artisan 命令Git
- empire帝國cms 標題、關鍵詞、描述替換的sql命令SQL
- Linux命令—–CP命令Linux
- 【Linux命令】grep命令Linux
- Linux命令--ps命令Linux
- linux圖形化介面和命令介面切換的快捷鍵Linux
- linux替換文字內容Linux