I would like to achieve this in Bash: echo $(a=1)
and print the value of variable a
I test eval
, $$a
,{}
, $()
but none of them work as most of the times either I got literally a=1
or in one case (I don't remember which) it tried to execute the value.
I known that I can do: a=1;echo $a
but because I'm little fun one command per line (even if sometimes is getting little complicated) I was wondering if is possible to do this either with echo
or with printf