Re: Dash problem with IFS

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


>  So if you want it to have a tab and newline you need to specify
>  them literally, or use something that does interpret escapes,
>  like

newline and tab, because in output substitution trailing '\n's
(default in any `echo`) are removed.

>  IFS=$(echo '\n\t $')

`echo` isn't a good example due to historical feature-support problems, imho.

# newline and tab
IFS=`printf '\n\t'`
# just newline
IFS=`printf '\n+'`; IFS=${IFS%+}

last example is POSIXly correct ugliness. Bashizm looks better (:

IFS=$'\n'

where $' ' is one, not "\t is <tab> in $IFS", guys.
-- 
sed 'sed && sh + olecom = love'  <<  ''
-o--=O`C
 #oo'L O
<___=E M
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux