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 Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

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

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
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?
Sponsored Links
  #2 (permalink)  
Old 11-20-2003
google's Avatar
google google is offline Forum Advisor  
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 (permalink)  
Old 11-20-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
 

Join Date: Nov 2003
Location: Maryland
Posts: 445
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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 08:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66