|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to run multiple command in a single line?
Normally i would do this-
cd abc ls -ltr I wish to run above command in a single line, like this- cd abc | ls -ltr But above command doesn't works, it simply runs the second command, ignoring the 1st one. ![]() |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Replace the pipe (|) with a semicolon like this: Code:
cd dir-name; ls -lrt It will change the directory and then list it's contents. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
This is so cool. Thanks
Does this means I am not innovative or dumb...I know how to script...why this stuff did not come to my mind? There is a one way to know, can you tell me how did you first come to know about this? I've read unix books, but none talk like this at command level. |
|
#4
|
|||
|
|||
|
Quote:
Code:
cd dir-name && ls -lrt |
| The Following User Says Thank You to jlliagre For This Useful Post: | ||
agama (04-14-2012) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Quote:
Last edited by agama; 04-14-2012 at 03:03 PM.. Reason: clarification |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| running multiple command in a single line | anuragpgtgerman | Shell Programming and Scripting | 6 | 03-29-2012 07:19 AM |
| Multiple lines in a single column to be merged as a single line for a record | Bhuvaneswari | Shell Programming and Scripting | 1 | 08-11-2011 03:16 AM |
| Grep multiple strings in multiple files using single command | gagan4599 | UNIX for Dummies Questions & Answers | 2 | 01-19-2011 06:22 AM |
| make multiple line containing a pattern into single line | VTAWKVT | Shell Programming and Scripting | 13 | 12-04-2008 05:40 PM |
| single line input to multiple line output with sed | mitch | Shell Programming and Scripting | 8 | 07-16-2008 01:57 PM |
|
|