Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run commands automatically in interactive ssh session with apple shortcuts #881

Open
gabemorris12 opened this issue Jan 3, 2025 · 2 comments

Comments

@gabemorris12
Copy link

I would like to be able to automatically run consecutive commands in an ssh session, but I can't get the commands to run on the server interactively. Take this example:

image

I would like for this to launch my ssh session, then print "hello world" on the server, not the local a-shell instance. I could do it all in one command like this: ssh user@domain 'hello there', but this won't enter into the ssh terminal on the server. Is there a way to enter into the ssh session and run additional commands automatically?

@holzschu
Copy link
Owner

holzschu commented Jan 3, 2025

Okay, that one is challenging. I don't see an easy way to do it right now.

The most canonical way is probably:

  • put all the commands in a file,
  • use sftp to put that file on the server,
  • use ssh user@host file to run the commands,
  • and then ssh user@host to end with an interactive session.

But that is only a partial answer to your question. I'll have to think about how to make a more complete answer.
The Shortcuts app has a default action "Run script over SSH", which could be a better solution (followed by a-Shell to get an interactive session).

@gabemorris12
Copy link
Author

That's a good proposal. Thanks for the response, and the incredible tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants