On Friday 17 December 2004 01:27 pm, Kevin wrote:
> On Fri, 2004-12-17 at 12:33, Rob Wultsch wrote:
> > $sudo . /some/place/script.sh
>
> Not sure what you are trying to achieve with the dot (.) between sudo
> and the path. Works without it.
>
> $ echo -e "#! /bin/bash \n echo foobar" > deleteme.sh
> $ chmod +x deleteme.sh
>
> $ sudo . /home/kevin/deleteme.sh
> sudo: .: command not found
>
> $ sudo /home/kevin/deleteme.sh
> foobar
The dot is an alias for 'source', both of which will read and execute a file
in the shell's context. For all extent and purposes, this means that it will
execute a shell script even if the file isn't marked as an executable.
I have done this a decent bit even though I can't seem to think of an example
off the top of my head. It's definitely a useful and not uncommon thing to
do.
I'm guessing that this doesn't work with sudo since both . and source are
shell aliases.
If you really do not want (or can't) make the script executable, then you
could always do it this way:
$ sudo /bin/bash /some/place/script.sh
Kurt
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss