<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 12, 2020 at 8:48 PM Giles Orr via talk <<a href="mailto:talk@gtalug.org">talk@gtalug.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 10 Jul 2020 at 17:51, John Sellens <<a href="mailto:jsellens@syonex.com" target="_blank">jsellens@syonex.com</a>> wrote:<br>
><br>
> On Fri, 2020/07/10 05:39:59PM -0400, Giles Orr <<a href="mailto:gilesorr@gmail.com" target="_blank">gilesorr@gmail.com</a>> wrote:<br>
> | I love this list!  I thought that '[ -w . ]' and '[ -w $PWD ]' were<br>
> | practically equivalent.  "Practically" means, in this case, "almost."<br>
> | But not quite - and the difference is the solution to the problem.<br>
><br>
> It's a very important, though sometimes subtle, concept in unix-land<br>
> that there are multiple names for just about anything.<br>
><br>
> Here, obviously, $PWD is a variable substitution equivalent to /some/path,<br>
> which likely existed at some point, but may or may not exist now.  The<br>
> directory "." always (I think) exists, because a process always has a<br>
> current directory open. (Hmmm, but opendir(".") might not work?)<br>
><br>
> The other canonical example is "how do I remove a file that starts with -?".<br>
> The key to that of course is the multiple names thing "-file" (which looks<br>
> like an option string) is the same as "./-file" (which doesn't).<br>
><br>
> Once you understand that, the world opens up :-)<br>
><br>
> Of course, most times "rm -- -file" works but I'm old enough (uh, I mean<br>
> I've read about the history of unix) to know that -- didn't always exist.<br>
<br>
Here's a simple implementation of a Bash prompt using what we were discussing:<br>
<br>
PS1="\$(if ! [ -w "\${PWD}" ]; then echo -en '\[\033[41m\]' ; fi ;<br>
echo '\w\[\033[0m\]\$ ')"<br><br></blockquote><div>Hmmmm - - - - I do believe that you suggested  " . . . simple . . .  ." - - - yes?</div><div><br></div><div>Regards</div></div></div>