I wrote scripts to prompt for SSH connections and it reads my .ssh/config file for known hosts, then runs a shell script to ssh <hostname>. I store known hosts in the config file to abbreviate the command, and store\retrieve the password from keychain. Since updating to Sierra, the script often transposes characters and fails to make the connection. Example:
From ~/.ssh/config : Host AA7MainCM
Script output: ssh AA7MAinCM or ssh AA7MAINCM
ssh: Could not resolve hostname aa7maincm: nodename nor servname provided, or not known
My config file contains a variety of hosts with different login routines. So, I append a #Descriptor in the config file to each host, and grep\awk the data and redirect it to a temporary file to read for selection in the Dialog prompt based on the type of server I am connecting to. This also lets me use different login script steps based on the prompts from various classes of servers.
One sub reads the temp file into memory to display the list (appears correct in the dialog), and I highlight the one I wish to connect to which reads the string into a variable "myConnection" and proceeds to another sub which runs an execCmd("ssh " & myConnection) in terminal. I also use the myConnection variable to update the titlebar in Terminal which appears correct even when the script munges the execCmd output.
A snippet of the portion of code:
-- Run the SSH Login Script
my execCmd("ssh " & myConnection, 1) # This is the line that munges the variable output
set custom title of window 1 to myConnection # This line always displays the correct title
try
if conditional = true then
...
Again, prior to Sierra, this worked flawlessly, it now works intermittently. I am wondering if something might have changed in Sierra, or if there is another method of sending a variable to terminal that would not behave erratically.
Here is the execCmd routine I use:
on execCmd(cmd, wait)
tell application "System Events"
tell application process "Terminal"
set frontmost to true
keystroke cmd
keystroke return
end tell
end tell
delay wait
end execCmd
From ~/.ssh/config : Host AA7MainCM
Script output: ssh AA7MAinCM or ssh AA7MAINCM
ssh: Could not resolve hostname aa7maincm: nodename nor servname provided, or not known
My config file contains a variety of hosts with different login routines. So, I append a #Descriptor in the config file to each host, and grep\awk the data and redirect it to a temporary file to read for selection in the Dialog prompt based on the type of server I am connecting to. This also lets me use different login script steps based on the prompts from various classes of servers.
One sub reads the temp file into memory to display the list (appears correct in the dialog), and I highlight the one I wish to connect to which reads the string into a variable "myConnection" and proceeds to another sub which runs an execCmd("ssh " & myConnection) in terminal. I also use the myConnection variable to update the titlebar in Terminal which appears correct even when the script munges the execCmd output.
A snippet of the portion of code:
-- Run the SSH Login Script
my execCmd("ssh " & myConnection, 1) # This is the line that munges the variable output
set custom title of window 1 to myConnection # This line always displays the correct title
try
if conditional = true then
...
Again, prior to Sierra, this worked flawlessly, it now works intermittently. I am wondering if something might have changed in Sierra, or if there is another method of sending a variable to terminal that would not behave erratically.
Here is the execCmd routine I use:
on execCmd(cmd, wait)
tell application "System Events"
tell application process "Terminal"
set frontmost to true
keystroke cmd
keystroke return
end tell
end tell
delay wait
end execCmd
Last edited: