Bigfix action script taking shell script as comment

(imported topic written by Darknight)

Hi All,

I am trying to include the belwo script to find out tracks per cylinder and i am using it in bigfix action script and making a task which will run on the soalris machine :

for DISK in /dev/dsk/ctds; do value=prtvtoc "$DISK" | sed -n -e '/Dimensions/,/Flags/{/Dimensions/d; /Flags/d; p; }' | sed -n -e '/tracks\/cylinder/p'; if [ -n “$value” ]; then echo “TracksPerCylinder=$value”; else echo “$value” >/dev/null; fi; done 2>/dev/null | sed -e ‘s/*//g’ -e ‘s/tracks/cylinder//g’ -e ‘s/ //g’ | sort -u

the moment bigfix action acript find pattern “//” which i have used in sed command it treates it as a comment .

Can someone let me know how i can modify the action script so that my shell scrip will remain as it is and i get desired result. please advise.

For example in the action script one has to add additional opening curly brace if the shell script contains opening brace like : sed -n -e ‘/Dimensions/,/Flags/
{{
/Dimensions/d; /Flags/d; p; }’

Please suggest simmilar solution.

(imported comment written by Tim.Rice)

Are you creating a local script file with CREATEFILE UNTIL and executing it or are you trying to execute the command directly from the IEM Action?

(imported comment written by Darknight)

i am trying t oexecute a command directly from IEM action as below :

wait mkdir -p "__HardwareInfo/"
delete __appendfile
// to find tracks per cylinder
appendfile for DISK in /dev/dsk/c*t*d*s*
appendfile do 
appendfile value=`prtvtoc "$DISK" | sed -n -e '/Dimensions/,/Flags/{{ /Dimensions/d; /Flags/d; p; }' | sed -n -e '/tracks\/cylinder/p'`
appendfile if [ -n "$value" ]
appendfile then 
appendfile echo "TracksPerCylinder=$value" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile else 
appendfile echo "$value" >/dev/null 
appendfile fi
appendfile done 2>/dev/null | sed -e 's/*/ /g' -e 's/tracks\/cylinder/ /g' -e 's/ / /g' | sort -u
//modify appendfile to allow execution
delete inventory.sh
copy __appendfile inventory.sh
wait chmod 555 inventory.sh
wait bash inventory.sh

(imported comment written by Tim.Rice)

Try using the CREATEFILE UNTIL command rather than the APPENDFILE command.

Something like …

wait mkdir -p “__Hardware/‹Info/”

delete __createfile

// to find tracks per cylinder

createfile until ##END##

for DISK in /dev/dsk/ctds

do

value=prtvtoc "$DISK" | sed -n -e '/Dimensions/,/Flags/{{ /Dimensions/d; /Flags/d; p; }' | sed -n -e '/tracks\/cylinder/p'

if [ -n “$value” ]

then

echo “TracksPerCylinder=$value” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt

else

echo “$value” >/dev/null

fi

done 2>/dev/null | sed -e ‘s/*/ /g’ -e ‘s/tracks/cylinder/ /g’ -e ‘s/ / /g’ | sort -u

##END##

//modify createfile to allow execution

delete inventory.sh

copy __createfile inventory.sh

wait chmod 555 inventory.sh

wait bash inventory.sh

(imported comment written by Darknight)

thanks a lot TimRice…this was really of great help