Computing.Net > Forums > Unix > Command for status of last command

Command for status of last command

Reply to Message Icon

Original Message
Name: abhisri2k8
Date: August 4, 2008 at 00:03:38 Pacific
Subject: Command for status of last command
OS: unix
CPU/Ram: piv
Model/Manufacturer: pentium
Comment:

How to know the status of last command executed in unix exactly..... What is the command for that


Report Offensive Message For Removal

Response Number 1
Name: nails
Date: August 4, 2008 at 07:28:24 Pacific
Subject: Command for status of last command
Reply: (edit)

Look at the shell's exist code; if the last command was successful, the exit code is zero, else it is non-zero:

who > /dev/null

echo $?
0

xwho
ksh: xwho: not found

echo $?
127


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Command for status of last command

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software