Re: Syntax Question...

2011-08-15 Thread Linda Walsh
` Linda Walsh wrote: The latest error I got is a a simple type -- most of them probably are, with that many lines of code in ~3-4 weeks, there's bound to be -- trouble is I'm stubborn sometimes about 'punishing myself'' when I mess up...which isn't always productive! ;-) Sometimes typo's

Re: Syntax Question...

2011-08-15 Thread Greg Wooledge
On Mon, Aug 15, 2011 at 12:45:58AM -0700, Linda Walsh wrote: > #!/bin/bash -exu > alias sub=function > alias unless='if !' Aliases don't even *work* in scripts. > typeset -xr sub unless > > declare -a SAVE_ARGS=( "$@" ) > typeset -xr snapdir='snapdir' > > # in shell: white is black and black i

conditional aliases are broken

2011-08-15 Thread Sam Steingold
this works: $ alias z='echo a' $ zz(){ z b; } $ zz a b however, after sourcing this file: if true; then alias z='echo a' zz(){ z b; } fi I get $ zz bash: z: command not found $ type -a z z is aliased to `echo a' i.e., somehow zz is defined as function calling z, and z is defined as an alias

Re: conditional aliases are broken

2011-08-15 Thread Andreas Schwab
Sam Steingold writes: > this works: > > $ alias z='echo a' > $ zz(){ z b; } > $ zz > a b > > however, after sourcing this file: > if true; then > alias z='echo a' > zz(){ z b; } > fi Aliases are expanded during reading, but the alias command isn't executed until after the complete compound c

Re: conditional aliases are broken

2011-08-15 Thread Sam Steingold
> * Andreas Schwab [2011-08-15 18:42:30 +0200]: > > Sam Steingold writes: > >> this works: >> >> $ alias z='echo a' >> $ zz(){ z b; } >> $ zz >> a b >> >> however, after sourcing this file: >> if true; then >> alias z='echo a' >> zz(){ z b; } >> fi > > Aliases are expanded during reading, but

Re: conditional aliases are broken

2011-08-15 Thread Eric Blake
On 08/15/2011 01:10 PM, Sam Steingold wrote: * Andreas Schwab [2011-08-15 18:42:30 +0200]: Sam Steingold writes: this works: $ alias z='echo a' $ zz(){ z b; } $ zz a b however, after sourcing this file: if true; then alias z='echo a' zz(){ z b; } fi Aliases are expanded during read

Re: conditional aliases are broken

2011-08-15 Thread Andreas Schwab
Sam Steingold writes: > Cool. Now, what does this imply? "For almost every purpose, shell functions are preferred over aliases." Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely dif

Re: conditional aliases are broken

2011-08-15 Thread Sam Steingold
> * Andreas Schwab [2011-08-15 22:04:04 +0200]: > > Sam Steingold writes: > >> Cool. Now, what does this imply? > >"For almost every purpose, shell functions are preferred over aliases." so, how do I write alias a=b as a function? (remember that arguments may contain spaces &c) -- Sam S

Re: conditional aliases are broken

2011-08-15 Thread Eric Blake
On 08/15/2011 04:40 PM, Sam Steingold wrote: * Andreas Schwab [2011-08-15 22:04:04 +0200]: Sam Steingold writes: Cool. Now, what does this imply? "For almost every purpose, shell functions are preferred over aliases." so, how do I write alias a=b as a function? (remember that argu

Re: Syntax Question...

2011-08-15 Thread Dennis Williamson
On Mon, Aug 15, 2011 at 2:45 AM, Linda Walsh wrote: > > > > ` Linda Walsh wrote: >> >> The latest error I got is a a simple type -- most of them probably are, >> with that many >> lines of code in ~3-4 weeks, there's bound to be -- trouble is I'm >> stubborn sometimes >> about 'punishing myself''

Re: Syntax Question...

2011-08-15 Thread Linda Walsh
` Dennis Williamson wrote: On Greg already covered some important points and I'll add a few more. *cough* sorry, I just haven't responded ... I threw up my hands in disgust and got too irritated to respond, so have done other things. As has been said before, d