[英]Fill-in-the-Blank Shell Script
How do I write a shell script that will ask a question and then store the answer in a variable?如何编写 shell 脚本来提出问题,然后将答案存储在变量中? I am using bash in OS X.
我在 OS X 中使用 bash。
Basically, this is what I want to do:基本上,这就是我想要做的:
What is your name? (prompt for a name) You entered: (and the name that the user entered)
How about...怎么样...
#!/bin/bash
/bin/echo -n "What is your name? "
read name
/bin/echo "You said $name"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.