Reputation: 1
I am using ssh in a shell script in order to go on multiple linux server and get disk information on a particular disk. I am running following but I am not able to figure out the quote sequencing...In this example I am just capturing the header for my report....
ssh dbadmin@myserver bash -c '"df -kh | grep File | awk '{ print \$1 " | " \$2 " | " \$3 " | " \$4 " | " \$5 }' | tail -n -1"'
and following error...
bash: -c: line 0: syntax error near unexpected token |'
bash: -c: line 0:
df -kh | grep File | awk { print | | | | } | tail -n -1'
Any help or suggestions would be great...
Thanks
Upvotes: 0
Views: 648
Reputation: 786289
Better to use quoted here-doc and avoid escaping:
ssh -t -t dbadmin@myserver<<'EOF'
df -kh | awk -v OFS=" | " '/file/{ print $1, $2, $3, $4, $5 }' | tail -n -1
EOF
Upvotes: 2