问题描述
我需要从用于 linux 和 windows 的 .sh 脚本中询问用户名和密码,这怎么可能?
我试过了,但没有用:
#!/bin/bash
echo "Type the username,followed by [ENTER]:"
read username
echo "Type the password,followed by [ENTER]:"
read -s password
echo "The name entered was: $username"
echo "The path entered was: $password"
在 linux 和 Windows 终端上我得到这个:
>>bash try.sh
try.sh: line 2: $'\r': command not found
Type the username,followed by [ENTER]:
try.sh: line 4: $'\r': command not found
': not a valid identifierername
try.sh: line 6: $'\r': command not found
Type the password,followed by [ENTER]:
try.sh: line 8: $'\r': command not found
': not a valid identifieRSSword
try.sh: line 10: $'\r': command not found
The name entered was:
The path entered was:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)