I am using Putty to communicate over a serial interface, and I want to automate two commands. The first is "sc" and the other is "long_command". Previously I used the command:
putty -load session_name
To quickly open upp the Putty terminal then I can write "sc" or "long_command" as expected. To automate this I use the plink command:
$ foo='sc\n\r'
$ echo "${foo@E}" | plink -load session_name
Which works, however with the longer command:
$ foo='long_command\n\r'
$ echo "${foo@E}" | plink -load session_name
The printed output is: "long_comlong_co"
To overcome this I created the script long_command.sh:
comm1='swup'
comm2='date'
comm3='\n\r'
echo "${comm1@E}" | plink -load hydac&
echo "${comm2@E}" | plink -load hydac&
echo "${comm3@E}" | plink -load hydac&
;
And run it with
$ ./long_command.sh
Which works but looks crappy and if I use this command:
foo='long_command\n\r'
echo "${foo@E}"
It nicely prints long_command with a newline so... How do I send longer commands to plink?
I am on Ubuntu, with GNOME terminal, so if you have any other magic functions like screen or similar that you think is better I am all ears.