|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have a Temp.bash script:
#!/bin/bash shopt -s extglob echo * .!(|.|lyx|ddd|lftp|lyx|qt) If I do bash -n Temp.bash the shopt command is ignored, so the following line becomes an error rather than being properly expanded. I have to do bash -n -O extglob Temp.bash A more complicated script may turn various shopt switches on and off at various points in the script, so fixing the switch position at invocation may not solve the problem. Is there a simple work around, or is this simply a limitation that one has to live with? My end goal is simply to check the sanity of syntax without any side effects. Thanks. Fred |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
2007-07-29, 09:50(-04), Fred Ma:
> I have a Temp.bash script: > > #!/bin/bash > > shopt -s extglob > echo * .!(|.|lyx|ddd|lftp|lyx|qt) > > If I do > > bash -n Temp.bash > > the shopt command is ignored, so the following line becomes an error rather than > being properly expanded. I have to do [...] That's what bash -n does. It does *n*ot run the commands, just parses them. -- Stéphane |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Stephane CHAZELAS wrote:
> 2007-07-29, 09:50(-04), Fred Ma: >> I have a Temp.bash script: >> >> #!/bin/bash >> >> shopt -s extglob >> echo * .!(|.|lyx|ddd|lftp|lyx|qt) >> >> If I do >> >> bash -n Temp.bash >> >> the shopt command is ignored, so the following line becomes an error rather than >> being properly expanded. I have to do > [...] > > That's what bash -n does. It does *n*ot run the commands, just > parses them. OK, thanks. |
|
![]() |
| Outils de la discussion | |
|
|