Bash string change part of words -
i need change string before printing in bash
. did:
${retezec//./d}
now need change 1 more thing, -
_
. no idea how add there? in same step $`{retezec//./d;//-/_} , need 1 exeption 1 - ?
it's not possible nest parameter expansion, need 2 expressions:
foo=${retezec//./d} echo "${foo//-/_}"
you can, however, use external tool recommend stick native shell solution above.
$ echo "foo.-bar" | tr '.-' 'd_' food-bar
Comments
Post a Comment