2

I have a file which is created while running a certain task. I want to remove this file (if exist) on every fresh reboot. Can I use Startup applictions in ubuntu to remove this file.

example like this

rm -f $HOME/filename

Is this the right(without crashing my computer) way to remove a file on startup

1
  • I see no reason why it could be unsafe.
    – Pilot6
    Mar 16, 2016 at 9:20

1 Answer 1

1

If you are absolutely sure the filename/path is correct, I don't see why you shouldn't do it.

however

Startup Applications creates a .desktop file in ~/.config/autostart. You cannot use relative or variable paths like $HOME in a .desktop file, the command simply won't run. You need to use absolute paths.

6
  • 1
    Jacob, you might want to rephrase You cannot use relative paths like $HOME part..Variable $HOME always expands to full path to user's home dir....you might say any variable or relative path won't work..
    – heemayl
    Mar 16, 2016 at 9:24
  • @heemayl isn't You cannot use relative paths like $HOME the same as any variable or relative path won't work? Mar 16, 2016 at 9:27
  • I don't think so..my concern is relative paths like $HOME part..
    – heemayl
    Mar 16, 2016 at 9:28
  • @heemayl I am happy to edit if I understand what you mean, but what is the difference between "You cannot use" and "won't work"? Mar 16, 2016 at 9:31
  • $HOME is not a relative path. That's the difference.
    – muru
    Mar 16, 2016 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .