<分区>
我正在编写一个 bash 脚本
,如下所示
#!/bin/bash
#getting the environment variable from commandline
environment=$1
echo $environment
现在,当我使用 bash ./bashScript.sh Hello
运行脚本时,出现以下错误
: command not found line 2
: command not found line 5
我看到这两行都是空格,因此 bash 脚本给我一个错误
为了解决这个问题,我将脚本写成
#!/bin/bash
#
#getting the environment variable from commandline
environment=$1
#
echo $environment
但看起来有点乱
有没有其他方法可以做到这一点。提前感谢您的帮助。