-1

I have a update.sh file which has below command.

shyaml get-value  platform < ~/mcp_version/latest-versions.yaml

I am able to run the command through terminal, also the command runs from script.

Below is the content of script

echo "The platform is $now"
echo "PATH is '$PATH'"
platform = $(shyaml get-value  platform < ~/mcp_version/latest-versions.yaml)
echo "The platform is $platform"
shyaml get-value  platform < ~/mcp_version/latest-versions.yaml

But when I try to assign the output of the command to a variable then it gives error. as

./update.sh: line 12: platform: command not found

Below is the output when I run my script.

bash-4.2$ ./update.sh 
The platform is Fri Jul 12 11:57:25 IST 2019
PATH is '/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/bin/:/usr/bin/shyaml'
./update.sh: line 12: platform: command not found
The platform is 
19.06.00bash-4.2$ 
2
  • 5
    Remove space before and after equal.
    – Prvt_Yadav
    Commented Jul 12, 2019 at 6:45
  • For the future, use shellcheck.net
    – Panki
    Commented Jul 12, 2019 at 6:48

1 Answer 1

0

The correct answer is the first comment by @Prvt_Yadv:

Remove space before and after equal

Wrong:

platform = something

Correct:

platform=something

Not the answer you're looking for? Browse other questions tagged .