On Feb 27, Gerrit Pape <[EMAIL PROTECTED]> wrote: > > > Do you have an example where such a test on $PS1 is used? I'm unsure > > Yes, I have a script which must behave differently if started from init > > or by an user from the shell. $- does not work. > Hm, I fail to see how this works if I start a bash script from bash > login shell, PS1 is unset just as $- doesn't contain an i, what am I > missing?: Interesting... looks like I was partially wrong and this only worked with dash. I still think that this would be a nice thing to have, but it's obviously not much relevant anymore.
> Wouldn't it be better to check for the environment provided by sysvinit > (RUNLEVEL, PREVLEVEL, INIT_VERSION), or to check $PPID? No, because AFAIK these variables are not a standard. In the end I checked `tty` = "/dev/console", which also has other useful properties. -- ciao, Marco
signature.asc
Description: Digital signature