[Bug 1833817] [NEW] Substring expansion "${string%%' '*}" doesn't work
janlz
1833817 at bugs.launchpad.net
Sat Jun 22 15:29:52 UTC 2019
Public bug reported:
The following substring expansion to get the first word of a string
separated by spaces doesn't work using dash 0.5.8-2.10 on Ubuntu 18.04
LTS:
string="one two three four"
first="${string%%' '*}"
printf "%s\n" "$first"
It prints "one two three four", instead of "one". This works on bash and
Solaris sh, but not in dash.
Oddly, not putting the white space between single quotes works:
string="one two three four"
first="${string%% *}"
printf "%s\n" "$first" # Prints "one"
** Affects: dash (Ubuntu)
Importance: Undecided
Status: New
** Tags: bionic
** Tags added: bionic
** Summary changed:
- Parameter expansion "${string%%' '*}" doesn't work
+ Substring expansion "${string%%' '*}" doesn't work
** Description changed:
- The following parameter expansion to get the first word of a string
+ The following substring expansion to get the first word of a string
separated by spaces doesn't work using dash 0.5.8-2.10 on Ubuntu 18.04
LTS:
string="one two three four"
first="${string%%' '*}"
printf "%s\n" "$first"
It prints "one two three four", instead of "one". This works on bash and
Solaris sh, but not in dash.
** Description changed:
The following substring expansion to get the first word of a string
separated by spaces doesn't work using dash 0.5.8-2.10 on Ubuntu 18.04
LTS:
string="one two three four"
first="${string%%' '*}"
printf "%s\n" "$first"
It prints "one two three four", instead of "one". This works on bash and
Solaris sh, but not in dash.
+
+ Oddly, not putting the white space between single quotes works:
+ string="one two three four"
+ first="${string%% *}"
+ printf "%s\n" "$first" # Prints "one"
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dash in Ubuntu.
https://bugs.launchpad.net/bugs/1833817
Title:
Substring expansion "${string%%' '*}" doesn't work
Status in dash package in Ubuntu:
New
Bug description:
The following substring expansion to get the first word of a string
separated by spaces doesn't work using dash 0.5.8-2.10 on Ubuntu 18.04
LTS:
string="one two three four"
first="${string%%' '*}"
printf "%s\n" "$first"
It prints "one two three four", instead of "one". This works on bash
and Solaris sh, but not in dash.
Oddly, not putting the white space between single quotes works:
string="one two three four"
first="${string%% *}"
printf "%s\n" "$first" # Prints "one"
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dash/+bug/1833817/+subscriptions
More information about the foundations-bugs
mailing list