如何编写一个shell脚本来询问问题,然后将答案存储在变量中?我在OS X中使用bash 基本上,这就是我想要做的事情:
What is your name? (prompt for a name) You entered: (and the name that the user entered)
答案 0 :(得分:3)
答案 1 :(得分:2)
怎么样......
#!/bin/bash
/bin/echo -n "What is your name? "
read name
/bin/echo "You said $name"