I am trying to reduce typing by writing a script executing several ssh commands. While it is no problem to simply open an editor for example, I can't open an editor with a specific file:
this works:
editFile="ssh -X -t $username@$serverIP 'nano'"
$editFile
this doesn't:
editFile="ssh -X -t $username@$serverIP 'nano ~/test'"
$editFile
I also cannot connect to a screen like so, while simply starting screen works fine:
viewScreen="ssh -X -t $username@$serverIP 'screen -r screen1'
$viewScreen
If I add a -v flag, after the connection is established I get this error:
debug1: Sending command: 'nano /home/herb/.Scripts/test.txt'
bash: nano ~/test: No such file or directory
debug1: Sending command: 'screen -r screen1'
bash: screen -r screen1: command not found
Both commands work without a problem if typed in a terminal, so there must be some kind of magic I'm missing here!