Home > Back-end >  Bash - temporary files appear after sed
Bash - temporary files appear after sed

Time:07-31

in my script i edit a file by using "sed":

sed -i -e /NumberOfEntries=*/d "$playlist_name" > /dev/null   # deletes "NumberOfEntries"-line
sed -i -e '/^$/d' "$playlist_name" > /dev/null   # deletes all empty lines

This works just fine but while execution (and shortly after) there are one or two temporary files named something like "sedJjHEt2" (the string after sed changes everytime i run the script). The file is marked with a lock and red X-Symbol.

Is there a way to turn this off or am I missing something that I need to adjust? Or is this because of the "-i" Option?

Thanks in advance!

CodePudding user response:

Because of the "-i" Option. once you use "-i", sed will create a temporary, and then replace the original file with the temporary file.

  • Related