linux - save wild-card in variable in shell script and evaluate/expand them at runtime -


I have trouble running the script below (in Sigwin on win 7 mags) it "myscript.sh" "When I run it, it is the following which I input:

Year Month: 2011-03
Dinapatan: 2 {5,6,7} < / Strong>
logfile name: error *
query: warn

  #! / Bin / bash yearmonth = '' daypattern = '' logfilename = '' spath = '' q = '' echo -n "year:" year of eq-n read "daypattern:" read daypattern echo -n " Logfilename: "read logfilename echo-n" query: "q cat" $ yearmonth / $ daypattern / $ logfilename "Read | Grep --color $ q   

The output I get:

cat: / 2011-03 / 2 {5,6,7} / error * No directory on file exists.

However, if I enter Daytona = 25 or day time = 26, the script will work. In addition, if I type command in the shell, then the wildcard is expanded as expected, but this is not my wish. I want the user to be able to prompt him to enter the expression, and later, in the script, execute these commands.

Any ideas how it is possible?

Your help is greatly appreciated.

Try eval , should work for {A, d} And * cases

  eval grep --color $ q $ {yearmonth} / $ {daypattern} / $ {logfilename}    

Comments