0

I have a short script meant to do some server maintinence, but I can't for the life of my figure out how to properly use variables within my script, Here's a code sample to make it more clear:

--members "fmcfsv05a:aggr1_fmcfs05n01a_L" "businessgroup=='MDO'&&project==' $i '&&qslot=='Martini'"

In this sample, the "$i" is my variable, yet the output still yeilds this:

--members "fmcfsv05a:aggr1_fmcfs05n01a_L" "businessgroup=='MDO'&&project==' $i '&&qslot=='Martini'"

when ran with -v. Any ideas on how to force variables within single quotes?

  • 3
    recommendation: use sh/ksh/bash for scripts. Csh has inconsistencies in command line parsing in different points, and it leads to lengthy and frustrating debugging – mpez0 Apr 13 '15 at 20:16
  • What @mpez0 said. I learned that the lengthy and frustrating way. – Jarmund Apr 13 '15 at 20:23
0

Without going into the details why you should avoid CSH, this ran fine here:

$ cat test.csh 
set i="$1"
/bin/echo --members "fmcfsv05a:aggr1_fmcfs05n01a_L" "businessgroup=='MDO'&&project==' $i '&&qslot=='Martini'"

$ csh test.csh foo
--members fmcfsv05a:aggr1_fmcfs05n01a_L businessgroup=='MDO'&&project==' foo '&&qslot=='Martini'

$ dpkg-query -W csh
csh     20110502-2.1

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.