gpt4 book ai didi

linux - 在 Ubuntu Bash Shell 上使用 read -d 选项

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:19:38 24 4
gpt4 key购买 nike

我试图在我的脚本中使用读取命令的那个选项,但是当我执行它时我只收到错误消息“读取:-d 非法选项”。这是代码

 #!bin/bash

read -d "." -p "Write here: " var
var>$1

我试图在终端上输入相同的代码,但没问题。我已经检查了版本的 shell 并且是 bash。感谢帮助

最佳答案

使用 bash script.sh 而不是 sh script.sh 显式运行脚本。还要确保你有 bash:bash --version

关于linux - 在 Ubuntu Bash Shell 上使用 read -d 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24192445/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com