bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syntax error when setting variable in front of "while"


From: Ralf Goertz
Subject: syntax error when setting variable in front of "while"
Date: Fri, 06 Aug 2010 12:40:31 +0200
User-agent: KNode/4.3.5

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? The similar 

> FOO=BAR read a b && echo $a $b

works fine. (The problem occurred when I tried to temporarily set IFS to
the tab character for a "read").




reply via email to

[Prev in Thread] Current Thread [Next in Thread]