shell script to remove a file if it already exist

前端 未结 7 1098
面向向阳花
面向向阳花 2021-01-30 15:43

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

7条回答
  •  离开以前
    2021-01-30 16:07

    If you want to ignore the step to check if file exists or not, then you can use a fairly easy command, which will delete the file if exists and does not throw an error if it is non-existing.

     rm -f xyz.csv
    

提交回复
热议问题