Pass Variables to Bash Script

Hello everyone!

I recently got a job as a unix sysadmin, we run Mac OS X 10.10 on our laptops and we SSH into CentOS machines to perform diagnostics and repairs. What I’m trying to do is create a applescript that will prompt the user for the hostname, ask the user what they would like to do with the host, and then have the script execute it. I have the whole applescript thing down but just need to figure out how to pass the information collected through applescript to a bash script which will perform the required tasks.

I also have a couple questions as well…
Would this be the best way of approaching this?
Can a applescripter SSH into a machine using applescript?
and can we run a shell script to the ssh’ed machine using applescript and return the results?

This is a quite a complex task, even for applescript. So if anyone has any good ideas, alternative ways of automating these tasks, or any other insight would be very helpful!


Model: Macbook Pro Early 2015
Browser: Google Chrome 43
Operating System: Mac OS X (10.10)

You can start looking here and here.