(base) : ~/foo ; [ -w .. ] && echo true true (base) : ~/foo ; /bin/pwd pwd: .: No such file or directory (base) : ~/foo ; pwd /Users/dmason/foo (base) : ~/foo ; [ -w $PWD ] && echo true (base) : ~/foo ;
So, /bin/pwd fails and [ -w $PWD ] also fails, as John hypothesized ../Dave On Jul 10, 2020, 11:01 AM -0400, John Sellens via talk <talk@gtalug.org>, wrote: > On Fri, 2020/07/10 09:38:48AM -0400, Giles Orr via talk <talk@gtalug.org> > wrote: > | This gives immediate visual feedback on the write-status of the > | current directory. But test's '-w' and '-d' both claim that you're > | still in a valid directory under the above circumstances. Does anyone > | know of a simple way to find out if the directory you're currently in > | actually exists? > > The directory "." will still exist while you have it open (your current > directory), but will be unreachable, as you observed with stat(1) and > the number of links. > > Would checking for "test -d $PWD" work? I think $PWD is the full path > and so if it's no longer reachable, the test should fail? > > Hope that helps > > John > --- > Post to this mailing list talk@gtalug.org > Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk
--- Post to this mailing list talk@gtalug.org Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk