Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
linux compound commands

 
Post new topic   Reply to topic    dna88 Forum Index -> Linux and open source Discussion Forum
Author Message
tanveer
User
User


Joined: 21 Jun 2004
Posts: 85
Location: Dhaka,Bangladesh

Post Post subject: linux compound commands Reply with quote

As Aronnok said in a previous post to run multiple commands we have to do this
# date ; who | wc- l
Now suppose you want to maintain a count ofthe number of users logged on, along with a time/date in a log file. This could be accomplished with two commands:
# date >> logfile
# who | wc -l >> logfile
But why have to run two seperate commands though we know the syntax of running multiple commands as
# date; who | wc -l >> logfile

Guess what will happen?? Both commands will run but only the second one will redirect its output to logfile.
A subshell group will combine the commands so they r treated as one unit. To have a subshell we have to place then inside the parenthesis like

# (date; who | wc -l ) >> logfile
Sat Oct 16, 04 9:40 am
Back to top
tanveer View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Linux and open source Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group