Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

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

rajeshkumar created the topic: How to find success/failure status of a command in different shells?

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
Twitt me @ twitter.com/RajeshKumarIn

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x