why bash -c and su -c works different with signals?
MickeyJerry_at_gmail.com
Date: 08/31/05
- Next message: divtech: "Re: IMAP folders when the user doesn't have a shell?"
- Previous message: MickeyJerry_at_gmail.com: "why bash -c and su -c works different with signals?"
- Next in thread: Mickey Jerry: "Re: why bash -c and su -c works different with signals?"
- Reply: Mickey Jerry: "Re: why bash -c and su -c works different with signals?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Aug 2005 19:57:20 -0700
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NS->cat a.c
int main()
{
sleep(10);
exit(35);
}
NS->gcc a.c
NS->bash -c ./a.out ; echo $? (^C)
130
NS->bash -c ./a.out ; echo $? (^\)
Quit
131
NS->su -c ./a.out ; echo $? (^C)
0
NS->su -c ./a.out ; echo $? (^\)
0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NS->cat b1.sh
#!/bin/bash
echo start a.out
#su -c ./a.out
bash -c ./a.out
echo end a.out = $?
NS->./b1.sh (^C)
start a.out
NS->./b1.sh (^\)
start a.out
./b1.sh: line 4: 2519 Quit bash -c ./a.out
end a.out = 131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NS->cat b2.sh
#!/bin/bash
echo start a.out
su -c ./a.out
#bash -c ./a.out
echo end a.out = $?
NS->./b2.sh (^C)
start a.out
end a.out = 0
NS->./b2.sh (^\)
start a.out
end a.out = 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
why `su -c' always return 0 when it receive signals?
it may confuse the caller if the normal exit code is zero.
- Next message: divtech: "Re: IMAP folders when the user doesn't have a shell?"
- Previous message: MickeyJerry_at_gmail.com: "why bash -c and su -c works different with signals?"
- Next in thread: Mickey Jerry: "Re: why bash -c and su -c works different with signals?"
- Reply: Mickey Jerry: "Re: why bash -c and su -c works different with signals?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|