Pages - Menu

2022年11月22日 星期二

[LInux]alpine linux 宣告變數,error bad variable name

碎碎念

頭一次碰到這種坑,
我linux有待加強 (哭


正文

先看執行結果,
變數後面不能接空格,不然會出現錯誤。
等號後面也不能接空格,不然會出現錯誤。
平常程式寫太順,都習慣按空格了,
結果…

/ # export ab = "hello world"
sh: export: : bad variable name
/ # EXPORT ab = "hello world"
sh: EXPORT: not found
/ # export ab="helloworld"
/ # echo $ab
helloworld
/ # export ab = "helloworld"
sh: export: : bad variable name
/ # export ab ="helloworld"
sh: export: : bad variable name
/ # export ab= "helloworld"
/ # echo $ab
helloworlda

沒有留言:

張貼留言