You are not logged in.
I'm pulling my hair off this one...
I want to extract a substring from a variable in bash. It works fine all the time EXCEPT when the resulting string consist of only any number of "e" letters...
$ pkgname=kernel26-custom
$ echo ${pkgname#kernel26}
-custom
$ pkgname=kernel26-e
$ echo ${pkgname#kernel26}
(nothing)
$ pkgname=kernel26-ee
$ echo ${pkgname#kernel26}
(nothing)
$ pkgname=kernel26-eee
$ echo ${pkgname#kernel26}
(nothing)
$ pkgname=kernel26-eeee
$ echo ${pkgname#kernel26}
(nothing)
$ pkgname=kernel26eee
$ echo ${pkgname#kernel26}
eee
How come it does not work? What am I doing wrong? What is the rule for that? How can I extract "-eee" from the variable?
Thanx
Last edited by big_gie (2009-01-21 20:46:47)
Offline
Never mind... I have my answer... (thanx phrakture
"-e" is an echo flag... This works work (note the space):
$ pkgname=kernel26-eeee
$ echo " ${pkgname#kernel26}"
-eee
Offline