Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to pass a password with special characters to Windows? - SOLVED



On Sat, Jan 18, 2025, at 2:46 PM, zsh@xxxxxxxxxxx wrote:
> When I single-quote the whole thing, with or without the double-quotes, 
> I get "command not found".

Not the entire command.  Just the path(s).


> I did find that a single quote around just the password with the %codes 
> but not the double-quotes does work, so I have adopted that.
>
> Experimenting this morning has shown that the \ at the end can be be \ 
> or / or eliminated altogether, so I have now dropped that bit of ugliness.

Those aren't equivalent.  A trailing unquoted '\' is zsh syntax for
line continuation.  It is processed by zsh, and the invoked command
never sees it.

But yes, trailing slashes are often (but not always) optional.


> My current working version is:
> mount -t smbfs //username:'****%5E*******%25%29'@10.0.0.23/D 
> /Users/Shared/Windows-D

This should work as well.

	mount -t smbfs '//username:****%5E*******%25%29@10.0.0.23/D' /Users/Shared/Windows-D

It doesn't make a difference here, but if you don't really understand
quoting it is safer to quote characters that don't need it than to
leave characters unquoted and hope they don't mean anything to zsh.


> I did wonder where you found that formatting of the special characters, 
> none of my searches turned it up, but it works.

Percent-encoding is a standard and common method for handling special
characters in parts of URLs where they are not otherwise acceptable.
If you keep an eye on URLs in your web browser, you'll see it sooner
or later.

https://en.wikipedia.org/wiki/Percent-encoding
https://www.rfc-editor.org/rfc/rfc3986.html#section-2.1

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author