6 ms·
This was obvious to me, but one version of this that surprised me is when using scp. If you glob a remote destination like "scp myserver:*.jpg ./" It will proba
by seiferteric 7y ago
This was obvious to me, but one version of this that surprised me is when using scp. If you glob a remote destination like "scp myserver:*.jpg ./" It will probably work! But how? Because the remote path will likely not match any local files and the path with the asterisk will be passed to scp and scp will do the globbing on the remote side.
- tyingq 7y agoI mostly use ssh and tar instead of scp, because I'm usually after more than one file. Like, "ssh remote 'cd /whatever; tar -cf - someglobpattern' | tar -xvf"
- emmelaich 7y agoTip: get into the habit of using && rather than ; So... > ssh remote 'cd /whatever && tar -cf - someglobpattern' | tar -xvf
- gdavisson 7y agoSeconded. Here https://apple.stackexchange.com/questions/378942/cant-initialize-osx-interrogation-folder https://apple.stackexchange.com/questions/378942/cant-initia... is an example of what can happen from not checking for errors after a `cd` command. Summary: "sudo find ... -delete" ran in the root directory rather than the intended location, and now the OS is gone (probably along with lots more).
- tyingq 7y agoFair observation. I will change my ways :)
- nine_k 7y agoCould also be faster because of the common compression dictionary.
- heinrichhartman 7y agoeven better printf "<cmd>" | ssh bash or cat cmd.sh | ssh bash This passes all of stdin to the remote bash, avoiding any expansions happening on the local side entirely.