0

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.

Heneer
  • 313
  • 6
  • 17
  • What is `@E`? What do you get with `echo "${foo@E}" | cat`? – Martin Prikryl Aug 09 '18 at 13:23
  • I had a problem previously where the newline was not added correctly and found this answer on another question: https://stackoverflow.com/a/51486326/7689257 If I use with cat I also get: long_command – Heneer Aug 10 '18 at 10:07

0 Answers0