Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why is \ is converted to space on setting IFS='\'

var="'(]\\{}\$\""
IFS='\'
echo $var # '(] {}$" 
share|improve this question
1  
Has nothing to do with the “\”,that stands for any character: pastebin.com/fycLjxrx And is not converted, is split on that character due to word splitting performed on unquoted strings. –  manatwork Oct 4 '13 at 11:41
add comment

1 Answer 1

Because, that's what IFS does. It is the Input Field Separator, bash will split unquoted strings on that character and you have set it to \:

$ var="fooAbar"
$ IFS='A'
$ echo $var
foo bar
$ echo "$var"
fooAbar
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.