0

Set

S=2

then,

echo $S = echo "$S"=

bash -c " echo $S " = bash -c " echo '$S' " = bash -c " echo "$S" "



the most confusing one for me is bash -c " echo '$S' "

since echo '$S' = $S

How bash -c " echo '$S' " works like others?

tmp
  • 77
  • I guess if you weren't surprised, you wouldn't ask. The output of which commands surprised you? What else did you expect from these commands and why? – Kamil Maciorowski Aug 25 '21 at 23:53
  • Homework? Is there more context you could provide, and maybe edit the question to something more specific. Are you trying to make a shell script. All of the echo commands are different ways of doing the same thing, outputting the value of the S variable to stdout, normally the terminal display. – Brian Aug 25 '21 at 23:57
  • @Brain Sorry about that, I just added more specific question. Actually I would add more but I couldn't, my brain is burning, it's so struggling for me to even ask.. – tmp Aug 26 '21 at 00:16
  • @steeldriver Thanks for your reference, I have looked up on that for couple of times before, I ddin't get what I asked, or those answers are still too hard to understand for me. Thanks anyway. – tmp Aug 26 '21 at 00:33

0 Answers0