Quick question: mv !(file) !$

2009-01-08 Thread Yang Zhang
Hi, why doesn't the second command work? (Trying to move all files into a newly created directory.) $ mkdir dhclient $ mv !(dhclient) !$ bash: !: event not found -- Yang Zhang http://www.mit.edu/~y_z/

Re: Quick question: mv !(file) !$

2009-01-13 Thread Yang Zhang
Chet Ramey wrote: Yang Zhang wrote: Hi, why doesn't the second command work? (Trying to move all files into a newly created directory.) $ mkdir dhclient $ mv !(dhclient) !$ bash: !: event not found It doesn't work because enabling the `extglob' option doesn't cause bash

"$@" vs. nounset

2009-06-29 Thread Yang Zhang
variables set to empty arrays and unset variables are the same). As a result I'm forced to use "${@:-}" or something like that everywhere I use "$@" (which is really everywhere). Is there any other way around this? Any way to get a more selective nounset? Thanks in advance. -- Yang Zhang http://www.mit.edu/~y_z/

Re: "$@" vs. nounset

2009-06-29 Thread Yang Zhang
Mike Frysinger wrote: On Monday 29 June 2009 04:54:52 Yang Zhang wrote: Hi, I like using nounset for stricter scripts, but an annoyance is that anytime I use "$@" and it's empty, I get an error, when (to me, cognitively) it is not "unset" (as in someone *forgot* to se

Assigning to multiple variables on same line

2009-08-10 Thread Yang Zhang
Why does assigning to multiple variables on the same line exhibit sequential consistency normally but not for local variables? #!/usr/bin/env bash f() { local a=$1 b=$a c=0 d=$c echo $b echo $d } f x # Output: # b= # d=0 -- Yang Zhang http://www.mit.edu/~y_z/