From: Henrik Nyh Date: 2008-10-18T22:01:41+09:00 Subject: Re: Error Exception if script doesn't run On Sat, Oct 18, 2008 at 2:48 PM, jackster the jackle wrote: > Tim Hunter wrote: >> ~$ ls test.rb >> test.rb >> ~$ echo $? >> 0 >> ~$ ls nothere >> ls: nothere: No such file or directory >> ~$ echo $? >> 1 >> > Based on what you have described, I think I have figured out a way to > make it work...but I still have one question. > > When the following command completes successfully: > y= `cp /home/jsmith/js.txt /home/jsmith/js2.txt` > puts $? > > $? equals 0, however if I change the path to js.txt to something that > doesn't exist in order to make it fail, $? has a value of 256. > > I thought $? should always have a value of 1 when it fails? Why is it > 256? It is an error code, so it's sometimes other values than 1. Success is always 0.