Is there a way to use ` inside a ` in bash script
This works
echo `echo '(!1)*2' | bc -l`
but this doesnt
echo `echo '(!`echo 1`)*2' | bc -l`
the error is
unmatched '
how do I fix this?
You can make use of $()
instead of ``
:
$ echo $(echo $(echo $(echo "Hello") world)! )
Or the solution to your answer:
$ echo $(echo "( ! $(echo 1) )*2" | bc -l)
p.s. don't use '
when you want to make use of variables inside a string. Only double quotes "
are parsed.