Greg A.
Greg A.

Reputation: 75

script won't overwrite autostart

Here is the situation: I have a simple script which should add a line to the autostart file. Instead of overwriting, it makes a new file with the same name. If i execute the script again it adds the line to the new autoscript file.

//script
echo 'some text' >> /etc/xdg/lxsession/LXDE-pi/autostart

When i look in the LXDE-pi map and do "ls" then there is autostart and "autostart?" so somehow it makes new file and adds an "?" instead of overwriting.

Short: how do i add a line in the autostart file with a script file?

EDIT: this does the trick: Found a solution:

I rename the file to something, then add a new line, and rename it back. And set the permissions back to executable.

mv autostart autostartBU echo 'some text' >> autostart mv autostartBU autostart chmod 755

Upvotes: 1

Views: 134

Answers (1)

Nike Sprite
Nike Sprite

Reputation: 476

mv autostart autostartBU
echo 'some text' >> autostart
mv autostartBU autostart
chmod 755

Upvotes: 1

Related Questions