wesley coleman
wesley coleman

Reputation: 13

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

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.

Upvotes: 1

Views: 66

Answers (1)

Tolis Gerodimos
Tolis Gerodimos

Reputation: 4400

You could try

echo "$writing" >> "$filename"

Upvotes: 2

Related Questions