Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从用户输入一个字符并将相应的 ascii 值显示到屏幕上。这是我的代码。如果有任何错误,请更正并发布。
echo Enter a character read n printf "%d" $n;
错误-: ./ascii.sh: line 3: printf: a: invalid number
您需要在前面加上一个单引号$n:
$n
echo Enter a character read n printf "%d" \'$n
您还可以摆脱echo:
echo
read -p 'Enter a character: ' n printf "%d" \'$n
我想通过 ant 输入密码,我尝试使用,<input message但它显示输入的字符/密码。
<input message
我不想显示输入的字符,而是想显示“*”字符,任何人都可以告诉我这是怎么可能的。
谢谢, rbhawsar