Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Check write permissions
If you're doing it in the context of a var assignment why not just
my_variable=''; [[ -w . ]] || my_variable='my_value'
You could also use glob flags but that requires creating an array var
x=( .(N^w:s/./my_value/) )
On Wed, Jul 16, 2014 at 6:26 AM, Sepp Tannhuber <sepp.tannhuber@xxxxxxxx>
wrote:
> I am looking for an easy solution to monitor in my prompt whether PWD
> has write permissions or not. I use something like this:
> my_variable="${$([[ -w $PWD ]] || echo 0):+my_value}"
>
> This sets $my_variable to my_value when there are no write permissions.
> Although this works, it looks very complicated, especially with the echo
> command.
> And I am wondering if there is a more elegant solution. Does anybody have
> an idea?
--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
Messages sorted by:
Reverse Date,
Date,
Thread,
Author