[英]cant execute simple bash script on raspberry pi (raspbian)
Ok, so basically i have created the script by going to bin in the terminal and typing in 好的,所以基本上我已经通过在终端中bin并输入
sudo nano mytesterscript.sh
From there i wrote the script and saved it. 从那里我写了脚本并保存了。 To make it executable, i then used the command
为了使其可执行,然后我使用了命令
chmod +x mytesterscript.sh
then when i wanted to execute it by using 然后当我想通过使用执行它
./mytesterscript.sh
I get the error: 我得到错误:
bin/bash: bad interperter:no such file or directory
I can execute the script by typing 我可以通过键入执行脚本
bash mytesterscript.sh
but i want to be able to do it like 但我想能够做到
./mytesterscript.sh
Any ideas guys? 有想法吗?
#!bin/bash
#declare $STRING Variable
STRING= "Hello world"
#print variable on screen
echo $STRING
Make sure the top of your script says: 确保脚本顶部显示:
#!/bin/bash
Observe the /
in front of bin
. 观察
bin
前面的/
。
If that does not work, try which bash
and use that output. 如果那不起作用,请尝试使用
which bash
并使用该输出。
have happened to me right now :D But solution is not in 1st line but in space 现在发生在我身上:D但是解决方案不是在一线,而是太空
# replace:
STRING= "Hello world"
# by:
STRING="Hello world"
Took me approximately hour of struggling :D 花了我大约一个小时的苦苦挣扎:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.