linux - Invocation command using SSH getting failed? -
as per project requirement, need check content of zip file generated been generated on remote machine.this entire activity done using automation framework suites. has been written in shell scripts. performing above activity using ssh command abd execute unzip command -l , -q switches. command getting failed. , shows below error messages.
[someuser@machine ip function]$ ./tests.sh ssh someuser@machine ip unzip -l -q some_path/20130409060734*.zip | grep -i xml |wc -l unzip: cannot find or open some_path/20130409060734*.zip, some_path/20130409060734*.zip.zip or some_path/20130409060734*.zip.zip. no zipfiles found. 0
the same command had written manually works properly. have no idea.why getting failed whenever executed via shell scripts.
[someuser@machine ip function]$ ssh someuser@machine ip unzip -l -q some_path/20130409060734*.zip | grep -i xml |wc -l 2
kindly me resolve issue.
thanks in advance, priyank shah
when run command local machine, asterisk character being expanded on local machine before passed on remote ssh command. command expecting find some_path/20130409060734*.zip files on machine , insert them ssh command passed other machine, whereas (i'm assuming) mean, some_path/20130409060734*.zip files on remote machine.
for that, precede * character backslash ( \ ) , see if helps you. in shells escape character might defined differently , if yours 1 of them need find escape character , use 1 instead. also, use quotes around commands being passed other server. command line should in opinion:
ssh someuser@machine_ip "/usr/bin/unzip -l -q some_path/20130409060734\*.zip | grep -i xml |wc -l"
hope helps
Comments
Post a Comment