Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Oct 2022 02:10:09 +0000
From:      Pau Amma <pauamma@freebsd.org>
To:        Nuno Teixeira <eduardo@freebsd.org>
Cc:        FreeBSD Mailing List <freebsd-ports@freebsd.org>
Subject:   Re: sh: getting <category>/<portname> from pwd
Message-ID:  <637c1f11cd7428ce27da2adbbb558c43@freebsd.org>
In-Reply-To: <CAFDf7UJp9PkrhfMmJRKO7QNTmGQYu7BQYyqczoz-Dy7hP3h74g@mail.gmail.com>
References:  <CAFDf7UJp9PkrhfMmJRKO7QNTmGQYu7BQYyqczoz-Dy7hP3h74g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2022-10-25 22:14, Nuno Teixeira wrote:
> I'm writing a shell script to feed poudriere testports and I need to 
> get
> <category>/<portname> from ports tree:
> 
> `pwd`:
> /home/user/work/freebsd/ports/<category>/<portname>
> 
> `pwd | rev | cut -d / -f1,2 | rev` do the trick but it is so uggly!
> 
> Is there a shell option to get it?

I'd use basename(1) and dirname(1).

-- 
#BlackLivesMatter #TransWomenAreWomen #AccessibilityMatters 
#StandWithUkrainians
English: he/him/his (singular they/them/their/theirs OK)
French: il/le/lui (iel/iel and ielle/ielle OK)
Tagalog: siya/niya/kaniya (please avoid sila/nila/kanila)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?637c1f11cd7428ce27da2adbbb558c43>