[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: exit status issue
From: |
Dallas Clement |
Subject: |
Re: exit status issue |
Date: |
Fri, 18 Nov 2011 14:49:54 -0600 |
On Fri, Nov 18, 2011 at 2:35 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Fri, Nov 18, 2011 at 02:23:54PM -0600, Dallas Clement wrote:
>> [pid 6747] execve("/bin/touch", ["touch", "/mnt/array1/.accesstest"],
>> [/* 14 vars */]) = 0
>>
>> The = 0 at the end is the exit status.
>
> That is the return value of the execve() call. All it means is that
> the /bin/touch program was successfully launched.
>
> $ strace -f bash -c false
> ...
> execve("/bin/bash", ["bash", "-c", "false"], [/* 32 vars */]) = 0
> ...
>
> arc3:~$ bash -c false; echo $?
> 1
>
Yes, you are sure right on all counts. The (0) in SIGCHLD (Child
exited) @ 0 (0) is clearly not the exit status of the child either.
Proven by a simple test script.
#!/tmp/bash3
touch /bogus/file
echo $?
-------------
root@TS-2RVED8:/tmp# strace -f -e execve ./test.sh
execve("./test.sh", ["./test.sh"], [/* 15 vars */]) = 0
Process 7269 attached
Process 7268 suspended
[pid 7269] execve("/bin/touch", ["touch", "/bogus/file"], [/* 14 vars */]) = 0
touch: /bogus/file: No such file or directory
Process 7268 resumed
Process 7269 detached
--- SIGCHLD (Child exited) @ 0 (0) ---
1
Process 7268 detached
Thanks for setting me straight guys. I was misled. It looks like the
'touch' command really could be failing in my script.
- exit status issue, Dallas Clement, 2011/11/17
- Re: exit status issue, Geir Hauge, 2011/11/18
- Re: exit status issue, Greg Wooledge, 2011/11/18
- Re: exit status issue, Dallas Clement, 2011/11/18
- Re: exit status issue, Greg Wooledge, 2011/11/18
- Re: exit status issue,
Dallas Clement <=
- Re: exit status issue, Dallas Clement, 2011/11/22
- Re: exit status issue, Greg Wooledge, 2011/11/22
- Re: exit status issue, Dallas Clement, 2011/11/22
- Re: exit status issue, Greg Wooledge, 2011/11/22
- Re: exit status issue, Bob Proulx, 2011/11/22
- Re: exit status issue, Dallas Clement, 2011/11/22
- Re: exit status issue, Bob Proulx, 2011/11/22
- Re: exit status issue, Dallas Clement, 2011/11/22
- Re: exit status issue, Steven W. Orr, 2011/11/22
- Re: exit status issue, Andreas Schwab, 2011/11/23