I want to set a variable if my condition is true on my Ubuntu system.
This proves that my if-statement is correct:
$ (if [ 1 == 1 ]; then echo "hi there"; fi);
hi there
This proves that I can set variables:
$ a=1
$ echo $a
1
This shows that setting a variable in the if-statement DOES NOT work:
$ (if [ 1 == 1 ]; then a=2; fi);
$ echo $a
1
Any ideas why? All my google research indicates that it should work like this...
sed
command is doing and why you are using it? – Kusalananda Nov 20 '18 at 18:49