bash

How to write String to a text File


My question is about file handling in bash. I want to write a string to text file in Bash script. I have already tried

echo string>>filename.txt

Solution

  • your code is correct.you can write to a file using that.But you have to check the file access permission of the file you want to write the data in to. Check following for more details. Create text file and fill it using bash Open and write data to text file using bash/shell scripting