How to write a bash script that reads an input from the user then writes to a file

Viewed 40

I'm trying to write a bash script that asks for input then writes it to a file.

echo "What would you like to write to that file?"
read writing
writing >> $file.txt

I tried doing something like this but it didn't work.

1 Answers

You could try

echo "$writing" >> "$filename"
Related