can someone explain this?
can someone explain this?
"echo" prints the value of its arguments to its output, which is usually the screen. "$status" evaluates to the value of the variable "status". Here's a bash example.
Code:$ status=something $ echo Hello, World! Hello, World! $ echo $status something $ status='something else' $ echo $status something else $
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
so if my main function returns one calling echo $status directly after that will print 1
??
so when will echo $status return 1 when called?
It would, if $status were set -- however, I think the variable you're looking for is $?, in bash at least.so if my main function returns one calling echo $status directly after that will print 1
??
From http://tldp.org/LDP/Bash-Beginners-G...ml#table_03_03$? Expands to the exit status of the most recently executed foreground pipeline.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
how do i set $status??
because I typed in echo $status and it doesn't print anything, just a blank line
I did the echo $status just directly after I run the main
Well, try $?. If that doesn't work, tell us what shell you are using.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
I am using a korn shell
thank you