in reply to Re^3: getting shell expansion to work
in thread getting shell expansion to work
I too am minorly surprised that '/bin/sh' allows the the non-posix extensions... Definitely not something to rely on...
Another solution that I ran across was to use bash as a 'filter' of sorts:
It sorta *bums* me that 'semicolon' isn't equivalent to '\n' in this case. There might be a bug there, somehow: if "shopt cmdhist"=on, then bash tries to store multiline commands in one history entry. Then, if "shopt lithist" is off (I think that's default), then bash will store multi-line commands separated by a semicolon (instead of the newline which would have separated the commands of the multi-line command). As you point out, this isn't equivalent to separation by a newline.$pat='+([^-])-+([^-]).rpm'; $a=`echo 'echo gcc-$pat'|bash -O extglob`; #-O=capital 'O'
It would be a rare error case, but if one concocted a multi-line command that turned on 'extglob'bing, followed by its usage, then that multi-line command sequence would be stored with semi-colons, so on recall, it would contain the non-working semi's instead of the requisite newlines... (and people wonder how it is that I so often break things...:-) )
L
|
|---|