The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to delete text from line starting pattern1 up to line before pattern2? repudi8or Shell Programming and Scripting 5 04-15-2008 06:25 PM
Running two commands in one line rdns UNIX for Dummies Questions & Answers 2 11-30-2007 03:14 AM
Seperate commands on the same line bobk544 Shell Programming and Scripting 3 07-28-2007 02:14 PM
code that reads commands from the standard i/p and executes the commands Phrozen Smoke High Level Programming 4 01-21-2007 11:06 PM
Commands and Command Line Flags Kedgeboy Shell Programming and Scripting 4 07-11-2005 07:23 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-20-2003
Registered User
 

Join Date: Nov 2003
Posts: 3
two commands on 1 line

wuts the command that allows u to use 2 commands on one line?
Forum Sponsor
  #2  
Old 11-20-2003
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Quote:
wuts the command that allows u to use 2 commands on one line?
if you dont mind, english please! Read the rules of the board.

you can run multiple commands on a single line by separating the commands by a semi colon.

example:

echo $PWD ; ls -a

You can also run multiple commands on a single line via a pipe. The pipe takes the output of one command and "pipes" it as input to another command.

example:

ps -ef | grep ORA
  #3  
Old 11-20-2003
kduffin's Avatar
UN1X
 

Join Date: Nov 2003
Location: Virginia
Posts: 441
Also, if you want to conditionally execute the second command based on the return code of the first you can use || or &&.

<command1> && <command2> will execute command2 if command1 returns a value >= 0 (ie success).

<command1> && <command2> will exeucte command2 if command1 returns a value < 0 (ie failure)

Cheers,

Keith
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0