[Novalug] Shell Puzzle Challenge

RJ Bergeron rbergero at gmail.com
Fri Mar 16 18:02:36 EDT 2012


On Fri, Mar 16, 2012 at 18:00, James Ewing Cottrell 3rd
<JECottrell3 at comcast.net> wrote:
> Write a shell function called "ispath" which returns true if its
> argument is part of $PATH, otherwise false
>
> In other words, I want to use it like this:
>
> export PATH=/sbin:/usr/sbin:/bin:/usr/bin
>
> if ispath /bin
> then echo YES
> else echo NO
> fi

Unfortunately, the examples aren't making it clear what you'd want it
to do in this case:

export PATH=/usr/bin
ispath /bin
echo $?

Would this match due to "/bin" being in the string or fail due to
"/bin" not being a complete path element?

RJ


More information about the Novalug mailing list