https://bugzilla.novell.com/show_bug.cgi?id=340952#c5 Torsten Foertsch <torsten.foertsch@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |torsten.foertsch@gmx.net Status|NEEDINFO |NEW Info Provider|torsten.foertsch@gmx.net | --- Comment #5 from Torsten Foertsch <torsten.foertsch@gmx.net> 2007-11-27 05:41:11 MST --- Replying to comment #2, I think I can say it wont work (without actually trying out). $0 is the name of the shell script not the shell itself if the shell is invoked via a shebang line. So if the script /usr/sbin/Check is called $0 is "/usr/sbin/Check" not "/bin/sh". I agree it would be better to solve this without external programs and even better without /proc. I'd really like to learn how that can be done. Replying to comment #3, I agree there is more to do than what my initial report recommends. I was trying to resolve my current problem. That is I was trying to make /usr/sbin/Check work in my environment. Maybe it would be better to do the extra check only if is=bash. The problem is not a login shell it is a script like /usr/sbin/Check that starts with #!/bin/sh (not #!/bin/bash) and sources /etc/profile: #!/bin/sh /etc/profile Then something like this would work: case "`/bin/ls -l /proc/$$/exe`" in */bash) # The next line is based on an erroneous behavior of the current bash. # It stops reading at the first NULL byte. read x </proc/$$/cmdline case "$x" in sh|*/sh) is=sh ;; *) is=bash ;; esac ;; */ash) is=ash ;; */ksh) is=ksh ;; */pdksh) is=ksh ;; */zsh) is=zsh ;; */*) is=sh ;; esac It works without external programs. But see the comment. It may not work for future bashs. That way a login ash works: $ bash -c 'exec -la /bin/sh /bin/ash' r2@opi:/home/r2> echo $is ash r2@opi:/home/r2> as well as a bash that is invoked as /bin/sh via a shebang line. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.