Affects xenial too. There is definitely something wrong.
Several notes on this:
1. A direct call to "echo ${f[@]:0:1}" outputs "a". The problems thus
lies in the variable assignment.
2. If first_char=${f[@]:0:1}, then echo "$first_char" outputs \001 but
"declare -p first_char" outputs \001\001
3. Double-quoted first_char="${f[@]:0:1}" puts "a" in first_char like in
Precise
4. first_char=${f[*]:0:1} has the same behaviour
5. Anyway, proper syntax should be first_char=${f:0:1} since you
consider f as a string. If you want to force bash to consider f as an
array (with the ${f[@]} syntax), then first_char=${f[@]:0:1} should put
f[0] in first_char, that is "abcd", not "a". So IMHO both Precise and
Trusty results are wrong.
** Tags added: xenial
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1381567
Title:
Bash returns unexpected character \001 on string operation
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1381567/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs