Discussion:
Changing the value of $?
(too old to reply)
Angel Tsankov
2006-10-18 09:21:46 UTC
Permalink
How can I most easily and most safely set the value of $? to
non-zero?
Ralf Fassel
2006-10-18 09:38:21 UTC
Permalink
* "Angel Tsankov" <***@fmi.uni-sofia.bg>
| How can I most easily and most safely set the value of $? to
| non-zero?

man false

R'
Chris F.A. Johnson
2006-10-18 10:00:20 UTC
Permalink
Post by Angel Tsankov
How can I most easily and most safely set the value of $? to
non-zero?
Run a command that will fail, e.g., any one of:

false

[ $1 -eq 2 ]

[ x = "" ]

grep '^root:@@@:' /etc/passwd

find -name a b 2>/dev/null
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Continue reading on narkive:
Loading...