UPDATE: I learned input variables can be accessed with commands like xargs getopts() and using $@ $% and $# as well as !* for the output of last command
To clarify the question when I run a command like
rep="replace" && echo foobar | sed -e 's/.*/${rep}/'
the text is not replaced with variable contents I tried wrapping in brackets quotes and percent signs. I also tried seds insert command.
Any there any methods to debug or step thru Bash? I noticed pressing ctrl Z rather than ctrl C lets me see return values.
For those who like to say "duplicate" rather than answer; These posts didnt help me:
Replace string variable with string variable using Sed
"sed" special characters handling
Other notes: //WARNING// in this command I set an alias that runs itself is that bad practice? I think I was trying codegolf code and ending up making directories with [[ in my $home directory on live disc so careful on your install.
alias a="espeak $1" && b=$($a) //the b part runs it and can be omited
for example this works fine after the alias of a seq 11 -1 0 |a
alias countDown="seq $1 -1 0|a" doesn't work with countDown 10 as an example run.
This method omits sed command: @destenson post at Escape a string for a sed replace pattern
inputvar="foobar" && txt2replace="oo" && txt2replacewith="rench" && outputvar="${inputvar//"$txt2replace"/"$txt2replacewith"}" && echo $outputvar && echo $outputvar|a
helped