10 ms·
Remembering to write ssh localhost sh -c "'cd /tmp && pwd'" works but (a) ICK (b) I usually only remember this on about attempt three at the earliest.
by mst 3y ago
Remembering to write
ssh localhost sh -c "'cd /tmp && pwd'"
works but (a) ICK (b) I usually only remember this on about attempt three at the earliest.
- rascul 3y agossh will read commands from stdin so this will work: echo "cd /tmp && pwd" | ssh localhost Or with a here string that bash and a few others support: ssh localhost <<<"cd /tmp && pwd" I often use the here string method. Maybe one of those would be easier to remember.
- mst 3y agoOooh, the here string reads nicely to me and would require less thought about quoting/interpolation choices which is a win on its own even if it still takes me multiple attempts to remember to do that. Much appreciated.