shell - Bash: Passing parameters into environments of specific commands -
i know can pass parameters directly environment so:
parameter=value command
however doesn't work in case below, expect it:
func() { char in b c echo $char done } while ifs= read line echo "char: $line" done <<< $(func) this has output:
char: b c once this:
ifs= while read line echo "char: $line" done <<< $(func) it works fine. output is:
char: char: b char: c however have reset ifs parameter, circumvent. , i'd know reason behind this.
i use gnu bash, version 4.3.42(1)-release (x86_64-apple-darwin15.0.0)
this fixed in upcoming 4.4 release of bash.
bash-4.4$ func() > { > char in b c > > echo $char > done > } bash-4.4$ bash-4.4$ while ifs= read line > > echo "char: $line" > done <<< $(func) char: char: b char: c making here strings work (i.e., documented) bit of on-going process.
Comments
Post a Comment