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:
a=b
: assigns string "b" variablea
.a = b
: runs commanda
arguments=
,b
a= b
: runs commandb
in environment variablea
has empty string value.a =b
: runs commanda
argument=b
.
Comments
Post a Comment