linux - Bash, what is the missing argument for variable declaration? -


this question has answer here:

i wrote couple of bash commands in text document.

the first line tries assign bash-command-output-string variable test.

the second line echo whatever in variable test.

for reason error saying "test: missing argument after..."

echo echo echo ////////////////////////////////////////////////////////////// echo echo testing if can return head branch ref #ref = cat ~/desktop/hookerrepo/.git/head | awk '{ print $2 }' test = "$(cat ~/desktop/hookerrepo/.git/head | awk '{ print $2 }')" echo $test #for c in $(test); echo $c; done echo echo ////////////////////////////////////////////////////////////// 

what missing?

an assignment statement cannot include spaces before or after =. following have distinct meanings:

  1. a=b: assigns string "b" variable a.
  2. a = b: runs command a arguments = , b
  3. a= b: runs command b in environment variable a has empty string value.
  4. a =b: runs command a argument =b.

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -