I am working on some stuff where I am storing data in a file. But each time I run the script it gets appended to the previous file.
I want help on how I can remove the f
A one liner shell script to remove a file if it already exist (based on Jindra Helcl's answer):
[ -f file ] && rm file
or with a variable:
#!/bin/bash file="/path/to/file.ext" [ -f $file ] && rm $file