Author: Stan Eisenstat
Subject: Re: [Cs323] Output of sh
Date: Sunday, 18 Oct 2020, 07:30:45
> Message Posted By: Unknown
>
> Even when I run the script using '/c/cs323/Hwk3/mcBash', when I input '$0'
> I get '/home/classes/cs323/.bin/mcBash.xx'. Are we expected to output a
> similar path? If so, where did this path come from? Specifically the
> '.bin' and 'mcBash.xx' part.
bash sets $0 to the name of the program being run.
mcBash replaces $0 by that name.
But Hwk3/mcBash is not a Perl script but a setgid C
program that runs the real mcBash from a directory that
is only accessible by members of the group cs323ta,
whence the /c/cs323/.bin/mcBash.xx.
To avoid any confusion, I modified Hwk3/mcBash to
reset $0 to /c/cs323/Hwk3/mcBash.
--Stan-
PREV
INDEX
NEXT