Re: IFS boundary behaviour is not consistent passing arguments to a func
From:
Greg Wooledge
Subject:
Re: IFS boundary behaviour is not consistent passing arguments to a function for bash 4.3 or 4.4 .
Date:
Tue, 3 Oct 2017 11:30:46 -0400
User-agent:
NeoMutt/20170113 (1.7.2)
On Tue, Oct 03, 2017 at 03:26:03AM +0000, McCue, Glenn (SSC/SPC) wrote:
> ## list arguments in the function call.
> echo "first_arg=$first_arg"
> echo "RESULT_A=\`doit \"\$first_arg\":2:3:4:\$PATH\'"
> OIFS=$IFS
What on EARTH is this nonsense?
Pass arguments to commands by quoting them properly.
myfunc "$arg1 "argument two" "${lotsofargs[@]}"
http://mywiki.wooledge.org/Quoteshttp://mywiki.wooledge.org/BashFAQ/005
The content of IFS should be irrelevant for 95% of your script. It
should only be used when you explicitly set it, e.g. for the duration
of a single read command.
IFS=: read -r user hash uid gid gecos home shell < /etc/passwd
http://mywiki.wooledge.org/IFShttp://mywiki.wooledge.org/Arguments