2016-10-02 00:05:10 +05:30
|
|
|
set -- abc "d e"
|
|
|
|
|
|
|
|
echo 'Testing: !IFS $*'
|
|
|
|
unset IFS; for a in $*; do echo ".$a."; done
|
|
|
|
echo 'Testing: !IFS $@'
|
|
|
|
unset IFS; for a in $@; do echo ".$a."; done
|
|
|
|
echo 'Testing: !IFS "$*"'
|
|
|
|
unset IFS; for a in "$*"; do echo ".$a."; done
|
|
|
|
echo 'Testing: !IFS "$@"'
|
|
|
|
unset IFS; for a in "$@"; do echo ".$a."; done
|
|
|
|
|
|
|
|
echo 'Testing: IFS="" $*'
|
|
|
|
IFS=""; for a in $*; do echo ".$a."; done
|
|
|
|
echo 'Testing: IFS="" $@'
|
|
|
|
IFS=""; for a in $@; do echo ".$a."; done
|
|
|
|
echo 'Testing: IFS="" "$*"'
|
|
|
|
IFS=""; for a in "$*"; do echo ".$a."; done
|
|
|
|
echo 'Testing: IFS="" "$@"'
|
|
|
|
IFS=""; for a in "$@"; do echo ".$a."; done
|
|
|
|
|
2016-10-02 06:16:56 +05:30
|
|
|
echo 'Testing: !IFS v=$*'
|
|
|
|
unset IFS; v=$*; echo "v='$v'"
|
|
|
|
echo 'Testing: !IFS v=$@'
|
|
|
|
unset IFS; v=$@; echo "v='$v'"
|
|
|
|
echo 'Testing: !IFS v="$*"'
|
|
|
|
unset IFS; v="$*"; echo "v='$v'"
|
|
|
|
echo 'Testing: !IFS v="$@"'
|
|
|
|
unset IFS; v="$@"; echo "v='$v'"
|
|
|
|
|
|
|
|
echo 'Testing: IFS="" v=$*'
|
|
|
|
IFS=""; v=$*; echo "v='$v'"
|
|
|
|
echo 'Testing: IFS="" v=$@'
|
|
|
|
IFS=""; v=$@; echo "v='$v'"
|
|
|
|
echo 'Testing: IFS="" v="$*"'
|
|
|
|
IFS=""; v="$*"; echo "v='$v'"
|
|
|
|
echo 'Testing: IFS="" v="$@"'
|
|
|
|
IFS=""; v="$@"; echo "v='$v'"
|
|
|
|
|
|
|
|
# Note: in IFS="" v=$@ and IFS="" v="$@" cases, bash produces "abc d e"
|
|
|
|
# We produce "abcd e"
|
|
|
|
|
2016-10-02 00:05:10 +05:30
|
|
|
echo Finished
|