如何解决如何在 linux 和 windows 上使用 shell 脚本询问用户名和密码
我需要从用于 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 举报,一经查实,本站将立刻删除。