Bit Twister <
BitTw...@mouse-potato.com> wrote:
> Wanting to convert my old kde desktop shortcut files into new kde
> files.
>
> Seemed simple enough to get contents of what to save, and write to
> new file.
>
> I do not understand why I can not save those field's string.
> function parse_in_fn ()
> {
> while read -r line; do
> set -- $(IFS='='; printf "%s" $line)
> _wd=$1
> shift
printf re-uses the format string when there are more arguments than
format specifiers. With no spaces in the format string the arguments
will be concatenated in the output:
$ printf '%s' one two three ; echo
onetwothree
You're seeing something like this:
$ set -- $( line='one=two three' ; IFS='=' ; printf '%s' $line )
$ echo "$1" ; shift ; echo "$*"
onetwo
three
You either need a space after (or before) the %s or whitespace after
(or before) the first '=' in the input.
$ set -- $( line='one=two three' ; IFS='=' ; printf '%s ' $line )
$ echo "$1" ; shift ; echo "$*"
one
two three
Or you could follow Janis' advice.