Welcome, Guest
Username Password: Remember me

How to find success/failure status of a command in different shells?
(1 viewing) (1) Guest
Shell Script
  • Page:
  • 1

TOPIC: How to find success/failure status of a command in different shells?

How to find success/failure status of a command in different shells? 5 months, 2 weeks ago #742

  • rajeshkumar
  • OFFLINE
  • Moderator
  • I love software configuration management
  • Posts: 373
  • Points: 44699
  • Karma: 4
  • Honor Medal 2009
Ksh/Borne/Bash shell
$ ls /usr/bin
….
# when success value is 0
$ echo $?
0
$ ls /usr/bin/blah
ls: 0653-341 The file /usr/bin/blah does not exist
# when failure non-zero status
$ echo $?
1

c/Tcsh
$ ls /usr/bin
….
# when success value is 0
$ echo $status
0
$ ls /usr/bin/blah
ls: 0653-341 The file /usr/bin/blah does not exist
# when failure non-zero status
$ echo $status
1
Regards,
Rajesh Kumar
Build and Release Engineer
My Blog: community.scmgalaxy.com/pg/profile/rajeshkumar
  • Page:
  • 1
Time to create page: 0.48 seconds

     
    
Home Forum