Created
September 13, 2017 18:27
-
-
Save x-yuri/d933972a2f1c42a49fc7999b8d5c50b9 to your computer and use it in GitHub Desktop.
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
[yuri@yuri-nb /srv/http/s1/5] cat 1.sh | |
#!/usr/bin/env bash | |
set -eu | |
countArgs () { echo "$#"; } | |
arr=('') | |
countArgs "${arr[@]+${arr[@]}}" | |
countArgs ${arr[@]+"${arr[@]}"} | |
arr=() | |
countArgs "${arr[@]+${arr[@]}}" | |
countArgs ${arr[@]+"${arr[@]}"} | |
[yuri@yuri-nb /srv/http/s1/5] ./1.sh | |
1 | |
1 | |
0 | |
0 | |
[yuri@yuri-nb /srv/http/s1/5] bash --version | |
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu) | |
Copyright (C) 2016 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software; you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment