help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: small problem with BASH_SOURCE and PATH


From: Greg Wooledge
Subject: Re: small problem with BASH_SOURCE and PATH
Date: Fri, 11 Feb 2022 17:01:18 -0500

On Fri, Feb 11, 2022 at 10:24:46PM +0100, Alex fxmbsw7 Ratchev wrote:
> >> http://mywiki.wooledge.org/BashFAQ/028
> >>
> >
> > err from the page
> >
> 
> greg, consider overhaulting your whole page, or it gets marked as invalid
> as the others by me

It's a wiki.  It's publically writable.  Most of the pages on the wiki
have multiple contributors.

> > bash stup ; cat stup
> > stup: line 1: cd: stup/: Not a directory
> > /root
> > cd "${BASH_SOURCE%/*}/"
> > pwd

Haven't we already covered this?  You're using BASH_SOURCE and assuming
what will be in it conforms to a certain pattern.  And then you're calling
the script with "bash stup" which means the content of BASH_SOURCE does
*not* match the pattern you expected it to match.  It contains "stup"
rather than "./stup".

Fix your own bugs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]