Unable to get quotes working

influx

Active Newcomer
Joined
Jun 5, 2007
Messages
258
Reaction score
0
Points
0
Can someone help me get the below syntax correct? $node works, but due to the "/" or "\\" in filespace_name, it gets escaped and does not execute properly. It would be greatly appreciated if someone could "fix" the syntax to get the $fs part working. btw... I'm scrolling through a list in a specific order so I need to execute as below.

occupancy=`dsmadmc -se=$server -id=id -pa=pass -datao=yes -tabd "select physical_mb from occupancy where node_name='$node' and filespace_name='$fs'"`
 
Hi

in case you are using perl here, the ' and " must have \ in front.

occupancy = `dsmadmc -se=$server -id=id -pa=pass -datao=yes -tabd \"select physical_mb from occupancy where node_name=\'$node\' and filespace_name=\'$fs\'\"`
 
Sunhilow,

Thank you for advice... it worked well. Based on your response, I think you also may be able to help me with the following in a Perl script. It's the same type of problem but not exactly the same. I cannot get $cmd0 to execute with the ' '.

$cmd0 = "select status.server_name,stgpool_name,maxscratch \
from status,stgpools where maxscratch is not null \
and stgpool_name not like \'%VTL%\'";

open(SRV, "dsmadmc -id=$id -pass=$pass -se=$se -datao=yes -tabd '$cmd0' |") or
die "DSMADMC: $!\n";
 
It's a late reply, but it still may be helpfull:

1. Use Perl's qq function:

$cmd = qq|select physical_mb from occupancy where node_name='$node' and filespace_name='$fs'|;

2. I would also suggest downloading TSM.pm from CPAN, or use the ODBC drivers, and 'use' the DBI and DBD::ODBC packages. These will parse the output and make your life a touch easier :)
 
Back
Top