Operating System - HP-UX
1828868 Members
2368 Online
109985 Solutions
New Discussion

2'nd question C-shell script

 
SOLVED
Go to solution
Ionut Grigorescu_2
Super Advisor

2'nd question C-shell script

Hi gurus,

yet another one:
I want to pass a variable to a program which send a command to the coressponding network element like:
%script_name -n parent_element_name -c "ZEQV:BTS=$i:GPRS=N;"
which means send to the parent network node the command (-c) in quotation marks, where $i takes values from 1 to 248. The problem is it returns me a variable syntax error because of ":" after $i. I have tried to comment it out with "\" but in this case the command sent is like:
ZEQV_BTS=1\:GPRS=N; which is incorrect, because of \ (here I put 1 instead of current $i value). Single quotation marks are also incorrect because they prevent variable substitution also - why was C-Shell invented for :-))??

Thank you,
ionu
If it weren't for STRESS I'd have no energy at all
4 REPLIES 4
Massimo Bianchi
Honored Contributor
Solution

Re: 2'nd question C-shell script

try quoting the i with graph:

%script_name -n parent_element_name -c "ZEQV:BTS=${i}:GPRS=N;"

Massimo
Ionut Grigorescu_2
Super Advisor

Re: 2'nd question C-shell script

case closed
If it weren't for STRESS I'd have no energy at all
Gregory Fruth
Esteemed Contributor

Re: 2'nd question C-shell script

Just a suggestion:

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

I would also point out that csh doesn't seem to have a way
of defining subroutines or functions aside from putting them
in separate files and calling them like commands.
Ionut Grigorescu_2
Super Advisor

Re: 2'nd question C-shell script

I know Gregory, but I had to write it in csh, that was a requirement - now is OK, I have tested it in our testlab - it will be used during 80 nights in the livenetwork for an upgrade, once again many thanks to Massimo.
If it weren't for STRESS I'd have no energy at all