bash脚本未等待用户输入

时间:2020-05-20 07:24:07

标签: linux bash shell ubuntu

我写了一个小的bash shell脚本hello.sh,它将要求用户输入他的名字并再次打印用户输入的名字。

#!/bin/bash

echo "Enter your name : "
read uname
echo "Hello " $uname ", Welcome to shell scripting."

当我运行脚本时,./hello.sh不会等待用户输入,而是提供以下输出

./hello.sh: line 2: $'\r': command not found
': not a valid identifiere 3: read: `uname
Hello  , Welcome to shell scripting.

请对此提供帮助。

0 个答案:

没有答案
相关问题