bug-bash
[Top][All Lists]
Advanced

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

Assigning to multiple variables on same line


From: Yang Zhang
Subject: Assigning to multiple variables on same line
Date: Mon, 10 Aug 2009 11:41:27 -0700
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Why does assigning to multiple variables on the same line exhibit sequential consistency normally but not for local variables?

#!/usr/bin/env bash
f() {
  local a=$1 b=$a
  c=0 d=$c
  echo $b
  echo $d
}
f x
# Output:
# b=
# d=0

--
Yang Zhang
http://www.mit.edu/~y_z/




reply via email to

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