- Learning Linux Shell Scripting
- Ganesh Naik
- 117字
- 2021-06-25 22:02:54
Command grouping
Commands may also be grouped so that all of the output is either piped to another command or redirected to a file:
$ ( ls; pwd; date ) > outputfile
The output of each of the commands is sent to the file, outputfile. The spaces inside the parentheses are necessary:
$ ( w ; date ) > whoandwhen
The output of the w command and date will be redirected to the whoandwhen file:
$ (echo "***x.c***";cat x.c) > log.txt
Output:
This redirects the content of x.c with a heading ***x.c*** to the file out:
$ (pwd; ls; date) > log.txt
Output:
This redirects the output of commands pwd, ls, and date in the log.txt file.
推薦閱讀
- ABB工業(yè)機器人編程全集
- 工業(yè)機器人技術(shù)及應用
- 大型數(shù)據(jù)庫管理系統(tǒng)技術(shù)、應用與實例分析:SQL Server 2005
- Splunk Operational Intelligence Cookbook
- 項目管理成功利器Project 2007全程解析
- The Python Workshop
- 面向?qū)ο蟪绦蛟O(shè)計綜合實踐
- 新編計算機圖形學
- 在實戰(zhàn)中成長:Windows Forms開發(fā)之路
- Applied Data Visualization with R and ggplot2
- IBM? SmartCloud? Essentials
- PowerMill 2020五軸數(shù)控加工編程應用實例
- 21天學通Linux嵌入式開發(fā)
- 智慧未來
- AVR單片機工程師是怎樣煉成的