<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto"><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">(base) : ~/foo ; [ -w .. ] && echo true</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">true</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">(base) : ~/foo ; /bin/pwd</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">pwd: .: No such file or directory</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">(base) : ~/foo ; pwd</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">/Users/dmason/foo</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">(base) : ~/foo ; [ -w $PWD ] && echo true</span><span style="font-size: 20px"><br /></span><span style="color:#000000;background-color:#ededed;font-family:Menlo;font-size: 20px">(base) : ~/foo ; </span><span style="font-size: 20px"><br /></span><span style="font-size: 20px"><br /></span>So, /bin/pwd fails and [ -w $PWD ] also fails, as John hypothesized</div>
</div>
<div name="messageSignatureSection"><br />
<div class="matchFont">../Dave</div>
</div>
<div name="messageReplySection">On Jul 10, 2020, 11:01 AM -0400, John Sellens via talk <talk@gtalug.org>, wrote:<br />
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">On Fri, 2020/07/10 09:38:48AM -0400, Giles Orr via talk <talk@gtalug.org> wrote:<br />
| This gives immediate visual feedback on the write-status of the<br />
| current directory. But test's '-w' and '-d' both claim that you're<br />
| still in a valid directory under the above circumstances. Does anyone<br />
| know of a simple way to find out if the directory you're currently in<br />
| actually exists?<br />
<br />
The directory "." will still exist while you have it open (your current<br />
directory), but will be unreachable, as you observed with stat(1) and<br />
the number of links.<br />
<br />
Would checking for "test -d $PWD" work? I think $PWD is the full path<br />
and so if it's no longer reachable, the test should fail?<br />
<br />
Hope that helps<br />
<br />
John<br />
---<br />
Post to this mailing list talk@gtalug.org<br />
Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk<br /></blockquote>
</div>
</body>
</html>