shahrahulb
asked on
command line parameters
i m doing following in my original script:
$string = "Rahul Shah";
$command = "ssh server_name /u/rshah1/temp.pl QBS $string";
system($command);
my temp.pl script contains:
perint $ARGV[0] :: $ARGV[1] \n";
the output i get after executing the script is:
QBS :: Rahul
what i want is:
QBS :: Rahul Shah
$string = "Rahul Shah";
$command = "ssh server_name /u/rshah1/temp.pl QBS $string";
system($command);
my temp.pl script contains:
perint $ARGV[0] :: $ARGV[1] \n";
the output i get after executing the script is:
QBS :: Rahul
what i want is:
QBS :: Rahul Shah
$command = "ssh server_name /u/rshah1/temp.pl QBS '$string'";
ASKER
Hi Ozo,
It didn't worked...
It didn't worked...
ASKER
the strange thing is, if i manually go to ssh server_name and then run the script ./temp.pl QBS 'Rahul Shah', that works
but why it doesn't work thru my original script
but why it doesn't work thru my original script
#or better
system "ssh","server_name","/u/rs hah1/temp. pl","QBS", "\Q$string \E";
system "ssh","server_name","/u/rs
ASKER
You are amazing, Mr Ozo... That worked...
from where you find all the solutions...can u give me some tips
Rahul
from where you find all the solutions...can u give me some tips
Rahul
ASKER
oops. one more issue: i was using:
my $s_now = time();
print("$NAME: now = " . scalar(localtime($s_now)) . "\n");
$string = "$NAME: now = " . scalar(localtime($s_now)) . "\n";
$string .= "$NAME: using login host= $url\n$NAME: using username= $username\n\n$NAME: Request: GET $url\n";
after executing system "ssh","server_name","/u/rs hah1/temp. pl","QBS", "\Q$string \E";
the output i get is,
QBS pos.pl: now = Wed Mar 9 14:00:17 2005
it does not print the line "using login host = .......
Strange
my $s_now = time();
print("$NAME: now = " . scalar(localtime($s_now)) . "\n");
$string = "$NAME: now = " . scalar(localtime($s_now)) . "\n";
$string .= "$NAME: using login host= $url\n$NAME: using username= $username\n\n$NAME: Request: GET $url\n";
after executing system "ssh","server_name","/u/rs
the output i get is,
QBS pos.pl: now = Wed Mar 9 14:00:17 2005
it does not print the line "using login host = .......
Strange
Do you need those "\n" in there? they are getting interpreted by ssh before /u/rshah1/temp.pl is called
I mean, they are getting interpreted by the remote shell before /u/rshah1/temp.pl is called
"'\Q$string\E'"
"'\Q$string\E'"
ASKER
yeah. i need "\n"
its very important.
any solution ot my problem
its very important.
any solution ot my problem
system "ssh","server_name","/u/rs hah1/temp. pl","QBS", "'\Q$strin g\E'";
Note the '' in the ""
ASKER
i get the output in following manner"
pos\.pl\:\ now\ \=\ Wed\ Mar\ \ 9\ 22\:20\:34\ 2005
pos\.pl\:\ using\ login\ host\=\ https..........
there is an extra "\" embebeded after evry word.
for your infomation, the contents of $string is:
$string = "$NAME: now = " . scalar(localtime($s_now)) . "\n";
$string .= "$NAME: using login host= $url\n$NAME: using username= $username\n\n$NAME: Request: GET $url\n";
Rahul
pos\.pl\:\ now\ \=\ Wed\ Mar\ \ 9\ 22\:20\:34\ 2005
pos\.pl\:\ using\ login\ host\=\ https..........
there is an extra "\" embebeded after evry word.
for your infomation, the contents of $string is:
$string = "$NAME: now = " . scalar(localtime($s_now)) . "\n";
$string .= "$NAME: using login host= $url\n$NAME: using username= $username\n\n$NAME: Request: GET $url\n";
Rahul
> You are amazing, Mr Ozo... That worked...
concise and bery true.
concise and bery true.
ASKER
it is not working for me. i m getting extra "\" character. how do i get rid of that
ASKER
OZO,
did u try executing: system "ssh","server_name","/u/rs hah1/temp. pl","QBS", "'\Q$strin g\E'";
because i m getting extra "\" character
Rahul
did u try executing: system "ssh","server_name","/u/rs
because i m getting extra "\" character
Rahul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It Worked. :-)
can u please tell me how did u found the solution
Thanks a lot.
can u please tell me how did u found the solution
Thanks a lot.