Skip to contentSkip to conversation

fail to expand/assigned subshell output into a local variable

DISCUSSION Mike Frysinger 2 participants 3 messages Nov 8, 2007 – Nov 9, 2007

lore
Share & tools
lore
#0 lore raw

this code snippet incorrectly fails under dash:

$ { local f=$(date); }
local: 5: 8: bad variable name
-mike
#1 lore raw

== 11/8/07, Mike Frysinger ==

Quoted 1 line

this code snippet incorrectly

Why incorrectly? There's no assignments in the local. It's a built-in, thus word splitting does its job, and incorrect names, that start with digits and have other than alpha-numeric symbols, are syntax errors.

Quoted 1 line

fails under dash: $ { local f=$(date); } local: 5: 8: bad variable name

____

#2 lore raw

== 11/8/07, Oleg Verych ==

Quoted 4 lines

== 11/8/07, Mike Frysinger ==

Quoted 1 line

this code snippet incorrectly

Why incorrectly? There's no assignments in the local.

... in the man page (and i didn't used that `feature' myself);

Quoted 1 line

It's a built-in, thus word splitting does its job,

thus, double quotes will prevent this...

Quoted 4 lines

and incorrect names, that start with digits and have other than alpha-numeric symbols, are syntax errors.

Quoted 1 line

fails under dash: $ { local f=$(date); } local: 5: 8: bad variable name

____