Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH Windows to UNIX

I built a batch file from my windows machine that connects to a UNIX server. I Then want commands to execute in UNIX from the batch file. UNIX doesn't seem to recognize my commands after I am logged into the server. This is what I coded:

ssh SERVERNAME exit

Right now, I am just trying to make it log in and exit. I get logged into the server, but then the exit command does not execute. Does anyone know to make UNIX execute my commands after I'm logged in using this batch file?


1 Answers

exit isn't being executed because it isn't a command, it's a shell internal (which exit if you don't believe me). Try echo hello world instead.

like image 99
chaos Avatar answered Feb 14 '26 18:02

chaos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!