Passing SSH Command Parameters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing SSH Command Parameters
# 1  
Old 05-28-2008
Passing SSH Command Parameters

Hi,

I wan to pass arguments to remote script in Unix .

For that I'm using ssh

PFB the code I'm using:

ssh -t -l osdac 10.81.33.51 "cd /appl/OSD/LOGS/flstr010/test.sh "$1" "$2""



Problem is I'm not able to pass second argument .

Can anyone plz help me in resolving this.
# 2  
Old 05-28-2008
I am wondering if you can pass arguments to scripts executed via ssh

Code:
$ cat getipline.sh | ssh root@micky /bin/sh

As far my understanding it should not allow passing command line args to the script executed via ssh. I might be wrong too.

//Jadu
# 3  
Old 05-28-2008
Passing SSH Command Parameters

HI,
Thanks Jadu.
i can able to pass parameters in one server but if m trying same for another then its failing either its asking for password or its not passing both argument(both of these servers are different).

Suchita
# 4  
Old 05-28-2008
If it's asking for password, maybe the public key of the machine you are using to ssh from is not in the authorzized_keys on the target user@host's authorized_keys.

Quote:
"cd /appl/OSD/LOGS/flstr010/test.sh "$1" "$2""
Btw the syntax is wrong - you can't cd into a skript, only into a directory.

For the other machine not accepting the 2nd parameters, can you please post the command and output of the error here?
# 5  
Old 05-28-2008
Passing SSH Command Parameters

Thanks.


sorry code is ssh -t -l osdac 10.81.33.51 "/appl/OSD/LOGS/flstr010/test.sh "$1" "$2""



I'd made that entries now its not asking for password ...bt its not taking 2nd parameter. Smilie


-- suchita
# 6  
Old 05-28-2008
What about:
Code:
ssh -t -l osdac 10.81.33.51 /appl/OSD/LOGS/flstr010/test.sh "$1" "$2"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing command line parameters into script

Not a good post. (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

2. Shell Programming and Scripting

Passing password with SSH command

Hi Experts, I have specific requirement where I want to pass the password with the ssh username@hostname command . I dont want to use RSA public and private keys also. Because that will be on production server and no one wants to give access like that. Second thing it is production... (14 Replies)
Discussion started by: sharsour
14 Replies

3. Shell Programming and Scripting

Passing 2+ parameters to one command

I have a script that uses more than one parameter. It looks like this: for i in `cat /tmp/listofpolicies`; do for x in $(cat /tmp/lst |sed 's/^/\/usr\/openv\/netbackup\/db\/class\//g'); do /usr/openv/netbackup/bin/admincmd/bpplinclude $i -delete -f $x;done;done The problem is that the... (3 Replies)
Discussion started by: newbie2010
3 Replies

4. Shell Programming and Scripting

passing arguments in remote ssh command?

i have a bash script on serverA, when i run the script on the server, it runs fine. the way to run the script is like this ./script "option1" Now i am trying to call it from local laptop using ssh command, my command is as the following ssh serverA ~/script "option1" and i got error... (7 Replies)
Discussion started by: fedora
7 Replies

5. Shell Programming and Scripting

Passing parameters to Shell script for GREP command

I am using grep to capture date from a file . Since i need to use the shell script for different dates ,is it possible to pass the date parameter to the shell script the Script is as below grep -E "08 Aug 2008|2008-08-08"* somefile.txt>test.txt The above script file greps the... (1 Reply)
Discussion started by: sud.tech
1 Replies

6. AIX

Passing a command over SSH

I'm trying to run a command over ssh to AIX 5.2, something like: ssh machine ls but it just hangs. I can ssh into the machine and run a command, but can't pass it like above. Is there a security setting that disables this by default? If so, how do I change it? Thanks! (8 Replies)
Discussion started by: hansnueski
8 Replies

7. Shell Programming and Scripting

passing more than 9 parameters

hi, i am passing around 14 parameters for a script a=$1 b=$2 c=$3 d=$4 e=$5 f=$6 g=$7 h=$8 i=\"${9}\" shift j=\"${1}\" still for j it is displaying the 1st parameter value..how to make it take the 10th parameter (2 Replies)
Discussion started by: dnat
2 Replies

8. Solaris

Passing SSH Command Parameters

On Solaris 5.9, is there any way to pass parameter(s), via SSH, to a command defined in the remote host's authorized_keys file? We have a menu that uses SSH to control some apps on our various hosts. I've been tasked with enhancing it and making it more secure. So far, the local host menu... (2 Replies)
Discussion started by: PabloCruise77
2 Replies

9. Shell Programming and Scripting

passing command line parameters to functions - sh

All, I have a sh script of the following tune: function a () { #functionality.. } function b () { #functionnlity.. } function check () { # this function checks for env and if all fine call build } function usage () { #sh usage details } function build () { #calls either a or b or... (5 Replies)
Discussion started by: vino
5 Replies

10. UNIX for Dummies Questions & Answers

passing parameters to sleep command

Hi, Can any one help me with an example how to use Sleep command with parameters thanx, (1 Reply)
Discussion started by: nagaraju_svs
1 Replies
Login or Register to Ask a Question