Bash 出现意外令牌问题
当我在 vscode 中单独运行下面的脚本时,它似乎可以工作,它在第二行和第三行显示文字回车符。
当我将它放入更大的脚本中时,我遇到了这个问题
./script.sh: line 64: syntax error near unexpected token `newline'
./script.sh: line 64: `ipv6address=$(hostname -I | cut -d " " -f 2)'
有人可以建议吗
#!/bin/bash
ipv6address=$(hostname -I | cut -d " " -f 2)
tee -a <<EOF >/dev/null "$HOME"/ipv6
[network]
# replace the ip with yours
routable_ip ="$ipv6address"
EOF
The script below seems to work when I run it on its own in vscode it says literal carriage return on the second and third line.
When I put it into a larger script I get this issue
./script.sh: line 64: syntax error near unexpected token `newline'
./script.sh: line 64: `ipv6address=$(hostname -I | cut -d " " -f 2)'
Can any one advise please
#!/bin/bash
ipv6address=$(hostname -I | cut -d " " -f 2)
tee -a <<EOF >/dev/null "$HOME"/ipv6
[network]
# replace the ip with yours
routable_ip ="$ipv6address"
EOF
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论