Operating System - HP-UX
1834149 Members
4012 Online
110064 Solutions
New Discussion

Re: passing variables through remsh

 
SOLVED
Go to solution
steven Burgess_2
Honored Contributor

passing variables through remsh

Hi all

Probably someting really simple, yet I can't seem to work out why it won't work

If I try this from the command line it's ok

disk=$(sudo /usr/sbin/vgdisplay -v vg00 | grep -i 'pv name' | awk '{prin
t $3}' | sed 's/dsk/rdsk/g')

echo $disk

/dev/rdsk/c0t5d0

sudo /usr/sbin/diskinfo $disk

SCSI describe of /dev/rdsk/c0t5d0:
vendor: SEAGATE
product id: ST31230W
type: direct access
size: 1027432 Kbytes
bytes per sector: 512

Ok

If I try this from a script (as I have a few to do)


#!/usr/bin/sh

for file in $(do
echo "---------------------------------------" >> info
echo $file >> info
remsh $file -n 'sudo uname -a ;model;sudo /usr/sbin/ioscan -funCtape'>> info
remsh $file -n 'disk=$(sudo /usr/sbin/vgdisplay -v vg00 | grep -i 'pv name' | awk '{print $3}' | sed 's/dsk/rdsk/g');sudo /usr/sbin/diskinfo $disk' >> info
done

I get

grep: can't open name
syntax error The source line is 1.
The error context is
>>> {print <<<
awk: The statement cannot be correctly parsed.
The source line is 1.
awk: There is a missing } character.
Usage: diskinfo [ -b | -v ] filename
is a character special device file
-b to obtain disc size (in 1K blocks)
-v verbose mode

Any ideas ?

Just off to play squash, will reply when I get back

Thanks in advance

Steve
take your time and think things through
1 REPLY 1
Todd Lehr
Frequent Advisor
Solution

Re: passing variables through remsh

In your remsh command you have nested ' characters. I would replace the first and the last with ". This will allow your local shell and/or remsh to properly parse the line and pass the remainder ( with the ' ) to the remote system