I'd like to ssh a piece of shell script code into a single ssh command.
As you all know, you could ssh something like this:
and receive the output of that command being run on that machine. So, let's say I scripted something on the fly via command line like this:
Is there a way to get this bundled into 1 command via an ssh? If I bring up this quick script via the command history, I get:
The "^J" won't work. I tried. Is there some character I can use in it's place? I tried \n and \r, but no dice. Just so we're clear, I'm trying to do something like:
1)
In the above example the CP command will be executed only if the MKDir command was successful
2)
In the above example the CP command will be executed REGARDSLESS if the MKDir command was successful or not.
the second one is executed. i have tried that one.
but when trying the same like for i in 1 2 3;do;echo $i;done; is not working.
i don't know why it is not working.
please anyone send the the solution for the above.
Last edited by zxmaus; 12-19-2011 at 10:39 AM..
Reason: added code tags
Hello again gentlemen.
I would like to make a shell script to 'optimize' a plain text full of IPs.
Let's suppose to have this text file:
1.192.63.253-1.192.63.253
1.0.234.46/32
1.1.128.0/17
1.116.0.0/14
1.177.1.157-1.177.1.157
1.23.22.19
1.192.61.0-1.192.61.99
8.6.6.6
I want to... (2 Replies)
Hello,
I'm sure you'd have received a lot of questions like this, but I couldn't find anything relevant to my problem in the first search. Sorry in advance if this is a repeated question.
I'm trying to do an SSH inside a shell script and expect the shell script to connect to a remote server... (6 Replies)
Hi ,
I am trying to write an shell, which reads a text file (from a location) having a list of numbers of strictly 5 digits only ex: 33144
Now my script will check :
1) that each entry is only 5 digits & numeric only, no alphabets, & its not empty.
2)then it executes a shell script called... (8 Replies)
i have a Oracle table like
col1 col2
---- -----
a 1
b 2
c 3
when i write a script for it , it gives me all the data in one column.
Please give me the solution which gives the exact result like we see in sql editors.
for a in `echo "
set feedback off;
set pagesize 40;... (1 Reply)
Hello,
I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes.
... (2 Replies)
OK , ..
This is an odd one. I have a new server and I need to have a tunnel open to it.
I have this exact process running on a few others but this new one I just got is not allowing the script to connect.
I set up my users account and ssh keys
from the server that will host the tunneling i... (6 Replies)
Hello again :) ,
My script has an ssh command to run a script on a remote machine. The script has commands such as sqlplus and unzip. However, the return I get in my own terminal says it can't find sqlplus and unzip.
the ssh command is:
ssh user@host "cd ScriptDir; ./Script.sh"
and the... (6 Replies)
i want use ssh on the host01 to execute autoexec.sh on the host02 like following :
host01> ssh host02 autoexec.sh
autoexec.sh include nohup command like follwing :
nohup /home/jack/deletedata.sh &
after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Hi all,
I am trying to write a script in shell which can connect me to a remote server and run some commands my problem is i cant pass the password barrier.I read a lot of articles where bloggers have suggested not to use telnet and to use something more secure like ssh.I tried ssh but as soon... (8 Replies)