Re: syntax error when setting variable in front of "while"

2010-08-09 Thread Chet Ramey
On 8/8/10 10:17 PM, mfwit...@gmail.com wrote: > Interestingly, according to: > > info bash 'Basic Shell Features' 'Shell Commands' Pipelines > > we have: > > A `pipeline' is a sequence of simple commands separated > by one of the control operators `|' or `|&'. Sorry, the `simple' should

Re: syntax error when setting variable in front of "while"

2010-08-09 Thread Ralf Goertz
Dennis Williamson wrote: > while is a compound command. Only simple commands can have preceding > variable assignments. From man bash: Thanks. I just found out that I can get away with > while IFS=$'\t' read a b; do echo "$a" "$b"; done

Re: syntax error when setting variable in front of "while"

2010-08-09 Thread mfwitten
On Fri, Aug 6, 2010 at 5:40 AM, Ralf Goertz wrote: >> Bash Version: 4.0 >> Patch Level: 35 >> Release Status: release >> >> Description: >> >> I am used to setting variables in front of a command >> like in >> >>> LANG=C man mplayer >> >> However, I get a "bash: syntax error near unexpected >> tok

Re: syntax error when setting variable in front of "while"

2010-08-06 Thread Dennis Williamson
while is a compound command. Only simple commands can have preceding variable assignments. From man bash: The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described above in PARAMETERS. These assignment statement

syntax error when setting variable in front of "while"

2010-08-06 Thread Ralf Goertz
Bash Version: 4.0 Patch Level: 35 Release Status: release Description: I am used to setting variables in front of a command like in > LANG=C man mplayer However, I get a "bash: syntax error near unexpected token `do'" error when trying: > FOO=BAR while read a b; do echo $a $b; done Why? Th