hush: in a comment, document what -i might be doing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c33bbcb92f
commit
62f1eed1e1
@ -14657,11 +14657,10 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
}
|
}
|
||||||
state2:
|
state2:
|
||||||
state = 3;
|
state = 3;
|
||||||
if (
|
if (iflag
|
||||||
#ifndef linux
|
#ifndef linux
|
||||||
getuid() == geteuid() && getgid() == getegid() &&
|
&& getuid() == geteuid() && getgid() == getegid()
|
||||||
#endif
|
#endif
|
||||||
iflag
|
|
||||||
) {
|
) {
|
||||||
const char *shinit = lookupvar("ENV");
|
const char *shinit = lookupvar("ENV");
|
||||||
if (shinit != NULL && *shinit != '\0')
|
if (shinit != NULL && *shinit != '\0')
|
||||||
|
23
shell/hush.c
23
shell/hush.c
@ -10356,6 +10356,29 @@ int hush_main(int argc, char **argv)
|
|||||||
/* Well, we cannot just declare interactiveness,
|
/* Well, we cannot just declare interactiveness,
|
||||||
* we have to have some stuff (ctty, etc) */
|
* we have to have some stuff (ctty, etc) */
|
||||||
/* G_interactive_fd++; */
|
/* G_interactive_fd++; */
|
||||||
|
//There are a few cases where bash -i -c 'SCRIPT'
|
||||||
|
//has visible effect (differs from bash -c 'SCRIPT'):
|
||||||
|
//it ignores TERM:
|
||||||
|
// bash -i -c 'kill $$; echo ALIVE'
|
||||||
|
// ALIVE
|
||||||
|
//it resets SIG_INGed HUP to SIG_DFL:
|
||||||
|
// trap '' hup; bash -i -c 'kill -hup $$; echo ALIVE'
|
||||||
|
// Hangup [the message is not printed by bash, it's the shell which started it]
|
||||||
|
//is talkative about jobs and exiting:
|
||||||
|
// bash -i -c 'sleep 1 & exit'
|
||||||
|
// [1] 16170
|
||||||
|
// exit
|
||||||
|
//includes $ENV file (only if run as "sh"):
|
||||||
|
// echo last >/tmp/ENV; ENV=/tmp/ENV sh -i -c 'echo HERE'
|
||||||
|
// last: cannot open /var/log/wtmp: No such file or directory
|
||||||
|
// HERE
|
||||||
|
//(under "bash", it's the opposite: it runs $BASH_ENV file only *without* -i).
|
||||||
|
//
|
||||||
|
//ash -i -c 'sleep 3; sleep 3', on ^C, drops into a prompt instead of exiting
|
||||||
|
//(this may be a bug, bash does not do this).
|
||||||
|
//(ash -i -c 'sleep 3' won't show this, the last command gets auto-"exec"ed)
|
||||||
|
//
|
||||||
|
//None of the above feel like useful features people would rely on.
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
G.opt_s = 1;
|
G.opt_s = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user