Wow. That’s excellent. Another Zsh feature that I clearly need to learn
more about, because I use ’sed’ for that sort of thing _all the time_.
Thanks!
TjL
--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com
)
Twitter: @tjluoma
On Sun, Jul 29, 2018 at 11:32 AM Matthew Martin wrote:
> On Sun, Jul 29, 2018 at 08:56:21AM -0400, TJ Luoma wrote:
> > That works, and I haven’t found anything else that does. This:
> >
> > readlink /etc/localtime | sed ’s#.*/zoneinfo/##g'
>
> There's no need for external commands here.
>
> a=(/etc/localtime(:A)) # Resolve the symlink
> print ${a##*/zoneinfo/} # Remove text preceding and including /zoneinfo/
>
> - Matthew Martin
>