bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Severe IFS glob bug needs patch [was: Setting IFS='*' causes bash to


From: Eduardo Bustamante
Subject: Re: Severe IFS glob bug needs patch [was: Setting IFS='*' causes bash to freeze on tab completion]
Date: Fri, 4 Nov 2016 01:26:08 -0600

If you want to split with read, use a tempenv IFS:

    dualbus@hp:~/local/src/gnu/bash$ bash -c 'IFS="?" read a b c <<<
"hello?world?xyz"; echo "$a"'
    hello

If you want to split using word splitting:

    dualbus@hp:~/local/src/gnu/bash$ bash -c 'v="hello?world?xyz";
IFS="?"; set -- $v; unset IFS; echo "$1"'
    hello

If you want to use the $* parameter:

  dualbus@hp:~/local/src/gnu/bash$ bash -c 'set -- abc def ghi;
IFS="?"; echo "$*"; unset IFS'
  abc?def?ghi

I didn't say there's no bug. There is. And when I said,
"self-inflicted harm", I meant that leaving as IFS='][?*' is not
really needed. If you need to do some word splitting, set the IFS, and
then restore its original value or unset it.

Perhaps I'm missing something here, but I think for the relevant use
cases of IFS, there are sane work arounds.

What other use case would require of setting IFS to such value permanently?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]