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

Time:03-23

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.

CodePudding user response:

You could try

echo $writing >> $filename
  •  Tags:  
  • bash
  • Related