Effect of flattening vector expansions in assignments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 4.2.45(1)-release | |
| var=${a[*]} ... one two three four | |
| var="${a[*]}" ... one:::two:three:::four | |
| var=$* ... one:::two:three:::four | |
| var="$*" ... one:::two:three:::four | |
| var=${a[@]} ... one two three four | |
| var="${a[@]}" ... one:::two three:::four | |
| var=$@ ... one two three four | |
| var="$@" ... one:::two three:::four |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 4.3.0(1)-beta | |
| var=${a[*]} ... one:::two:three:::four | |
| var="${a[*]}" ... one:::two:three:::four | |
| var=$* ... one:::two:three:::four | |
| var="$*" ... one:::two:three:::four | |
| var=${a[@]} ... one:::two three:::four | |
| var="${a[@]}" ... one:::two three:::four | |
| var=$@ ... one:::two three:::four | |
| var="$@" ... one:::two three:::four |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| function expassign { | |
| set -f | |
| typeset -a a | |
| a+=("$@") | |
| typeset var asn IFS= | |
| while IFS= read -r asn; do | |
| IFS=: command eval "$asn" | |
| printf '%-14s... %s\n' "$asn" "$var" | |
| done <<\EOF | |
| var=${a[*]} | |
| var="${a[*]}" | |
| var=$* | |
| var="$*" | |
| var=${a[@]} | |
| var="${a[@]}" | |
| var=$@ | |
| var="$@" | |
| EOF | |
| } | |
| ${ZSH_VERSION+:} false && emulate ksh | |
| expassign one:::two three:::four | |
| # vim: set fenc=utf-8 ff=unix ft=sh : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment