tolugboji writes:
> On Friday, October 15th, 2021 at 1:29 AM, Chris F.A. Johnson
> <chris@cfajohnson.com> wrote:
>
> > On Fri, 15 Oct 2021, tolugboji via wrote:
> >
> > > I have a path gmtbin, and would like to remove the /bin at the end.
> > >
> > > gmtbin="/usr/local/bin/gmt/bin"
> >
> > binless=${gmtbin%/bin}
>
> Right, I was using ${gmtbin/\/bin/}, which was removing the two /bin.
For directory paths in particular, you could also use dirname. It
removes only the last path component.