Good day,
I am very new to scripting but interested in learning more.
I have to do my 3par scripting with putty via SSH. I created the public/private keys but when I execute putty from command line and give an external file (my script) as an argument it just says "unprintable characters in command". The script works fine if I execute it interactively. Is this a putty- related issue or something else? '
Also, is it possible to execute multiple commands from one external file? What is the best practice using SSH?
Thank you very much for your help!
SSH scripting and Putty
Re: SSH scripting and Putty
Hi,
when you use kitty (beefed up putty) instead of plain putty, there is a "send script file" option in the menu. But this way isn't that good for real scripting, it just dumps the whole file as is. This can be a problem with commands that start a task (which you have to wait for before going on), or if you put some logic in your scripts. Error handling, loops, etc.
I prefer the ssh-cli for interactive working, but use a local installed cli for scripting.
But to be honest, I'm not a very savvy user of putty or kitty, so there might of course be a way to do better than I do
when you use kitty (beefed up putty) instead of plain putty, there is a "send script file" option in the menu. But this way isn't that good for real scripting, it just dumps the whole file as is. This can be a problem with commands that start a task (which you have to wait for before going on), or if you put some logic in your scripts. Error handling, loops, etc.
I prefer the ssh-cli for interactive working, but use a local installed cli for scripting.
But to be honest, I'm not a very savvy user of putty or kitty, so there might of course be a way to do better than I do
When all else fails, read the instructions.
- Richard Siemers
- Site Admin
- Posts: 1333
- Joined: Tue Aug 18, 2009 10:35 pm
- Location: Dallas, Texas
Re: SSH scripting and Putty
Putty is intended to be an interactive GUI.
plink (part of putty) is the command line version.
Try plink with your -m script.
plink (part of putty) is the command line version.
Try plink with your -m script.
Richard Siemers
The views and opinions expressed are my own and do not necessarily reflect those of my employer.
The views and opinions expressed are my own and do not necessarily reflect those of my employer.
Re: SSH scripting and Putty
Any reason why you have to do it via SSH and not via the CLI? The CLI is extremely powerful and has numerous features to make life easy for scripting.