Today I had to download a file to a server I was connected to via ssh:
The server I was running this on isn’t “mine” and thus cannot be trusted, thus I didn’t want to just specify
--password=PASSWORD on the command line as it would end up in at least the bash history and possibly other places, from where I’d need to delete it.
A IMO better way is to specify username and password interactively to the shell, using the
Command substitution (the backticks around the command) invokes a subshell, in which the
read is performed.
read assigns the input to the variable
REPLY, which I echo to standard output such that the invoking shell substitutes the command with this output.