Score:0

Bash parameter substitution (baparmsub?) Isnt working

fr flag

I am having a problem with feeding values like _PREROUTING _POSTROUTING to strip out alphabet chars :

a=${step/\_+([a-zA-Z]/\_}
[ note: replacing underscore with \x5f does nothing for the script although using sed works via 's/_[a-zA-Z][a-zA-Z]*/_/gp' but that is NOT what i __wanted__]   

(GNU)[https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html] seems to agree with me, my bash does(5.1) not have shop +patsub_replacement available for 5.2.

linux mint version and bash version see step variable and [original script in]
(Bash has problems with cmdline nft cmd vs script)

I tried [:alpha:] but neither works in script and rarely at the command line.

ArrowInTree avatar
fr flag
Some improvement at command line.Cite a place in the bash man page for escaping underscores?
br flag
I can't understand what you want to get in `a`? Just two underscores?
br flag
BTW, did you forget to put closing parenthesis? This `${step//_+([a-zA-Z])/_}` should work.
ArrowInTree avatar
fr flag
Alexey, yes two underscores mean something isn't an nft rule WITHOUT a hook or priority. See the link above.
ArrowInTree avatar
fr flag
Yes, in a non-interactive shell script it doesn't. Run the shell script with the "-x' option and tell me about the results.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.