Q:

How to record user input to a file in a shell script?

My friend was showing me a program in shell script where he made where he would open the program, it would ask a question, he would type an answer. Then it would close but whatever he typed as the answer would be transferred to a text document.

A:

I'd suggest starting with something like
#!/bin/bash

read -p "Your question here: "

echo "$REPLY" > somefile

You can read more about bash's read command either from the manual page (man bash) or by typing help read at the shell prompt.

