Swastik Udupa Swastik Udupa - 2 months ago 22
Bash Question

Search for a txt file,if it exists append a new line to it.If it doesn't,then create the file

I tried it using the normal commands

echo "${OPTARG}">>~/movie_history.txt

but >> works only if the file exists.
Is there any way I can make this work through shell scripting?


Just space out >>, some bash shells are sensitive to this.