Mailinglist Archive: opensuse-factory (689 mails)

< Previous Next >
[opensuse-factory] Re: why are raw scripts forced into /bin/sh instead of user's shell (a Suse patch to bash)
Ruediger Meier wrote:
On Friday 01 March 2013, Carlos E. R. wrote:
/bin/sh is a link to a shell. Linda, find out which it is in your
system.

And note that if you invoke /bin/bash by the /bin/sh link then some
bashisms are disabled.
---
ll /bin/sh
lrwxrwxrwx 1 9 Jan 23 02:03 /bin/sh -> /bin/bash
---
But the problem is what Ruediger Meier wrote -- if you don't
invoke the user's shell the way it is in their /etc/passwd (or in their SHELL --
usually the same), then you are changing the user's default shell with which
such scripts are executed.

I stumbled on to this because I typed a command -- re-edited it a few
times. It became multi-line, started to press 'v' in edit mode to
bring up the visual editor (vim/gvim in my case). Got tired of it flipping
back and forth -- wanted the editor to stay up while I continued executing it
and refining it. So saved it to /tmp/xx and used gvim on that -- then my
script no longer worked.

*IF* I put in #!/bin/bash at the beginning, then the correct shell is used,
but by default, it should use the same shell as what the user is running under
when they type the name of the shell script.

It would be like developing a shell script, then when I put it in a file and
execute it (w/o any header line), someone chose to run a #/bin/python on my
script instead of the shell I was using.

How can that make any sense?


--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation
References