[Discuss] bash-noob-question

Steven Kurylo sk at infinitepigeons.org
Sun Jan 24 08:17:16 PST 2010


PATH is a special variable, letting bash know where to look for the
various commands.  Since you overwrite it, bash can no longer find
chown.

On Sun, Jan 24, 2010 at 4:55 AM, Jan Felix Krutsch
<linux at grizzly-media.com> wrote:
> Hey guys,
>
> maybe one of you cracks is willing to help a bash-noob with a li'l problem ...
>
> I wrote the code:
> #!/bin/sh
>
> SRC="/media/usb-cargo/"
> echo "Change rights of directory ($SRC...):"
> read LOC
> PATH=$SRC$LOC
> echo "Change rights of [$PATH] (y/n)"
> read WERT
> if [ $WERT = "y" ]; then
> chown -R abuser $PATH && chgrp -R users $PATH && chmod -R 775 $PATH
> else echo "Cancled by user -> No changes made"
> fi
> echo ""
> echo "*** Done ***"
> echo ""
>
> and get the error-msg:
> /bin/chgright: line 10: chown: command not found
>
> If I type just 'chown + any command' in the console it works,
> in my code it doesn't (command not found) ... so I assume
> it's something wrong in the syntax.
> I wrote a little code before with
> "if -> command -> else -> other command -> fi"
> and the command worked ... *sight*  ... the bash-manuals I found online
> do not bring any light into this problem ... maybe one of you is willing to
> help out.
>
> Thanx
>
> Felix
>
> --
> ___________________________________________________________________
> Before you criticize someone you should walk a mile in their shoes.
> That way, when you criticize them you're a mile away and you have
> their shoes.
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>



-- 
Steven Kurylo


More information about the Discuss mailing list