简体   繁体   English

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

[英]Use of read -d option on Ubuntu Bash Shell

im trying to use that option of read command in my script but i get only the error message 'read: -d ilegal option' when i execute it. 我试图在我的脚本中使用read命令的选项,但是当我执行它时,我仅收到错误消息“ read:-d ilegal option”。 This is the code 这是代码

 #!bin/bash

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

Im trying to type the same code on terminal and its ok there. 我试图在终端上键入相同的代码,确定在那里。 I've checked the version's shell and is bash. 我已经检查了版本的外壳,并且是bash。 Thanks for help 感谢帮助

Run your script explicitly with bash script.sh not sh script.sh . 使用bash script.sh而不是sh script.sh显式运行脚本。 Also make sure you have bash: bash --version . 还要确保您拥有bash: bash --version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM