Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a VM with Lubuntu 14.04,

I have created a script,

echo "aaaa" >> a.txt

And my /etc/rc.local file is as follows:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

bash /home/sentinel/
echo "hey" >> /home/sentinel/b.txt
exit 0

On rebooting my machine, I can see b.txt built with content as hey but a.txt is not being built. Can somebody please help me here?

share|improve this question
No, b.txt doesn't exist. By built I mean created. That means second last line of the rc.local is executed, but 3rd last isn't. @JacobVlijm – Optimus Prime Sep 5 '14 at 8:17
up vote 8 down vote accepted

Mention complete path where a.txt should create.

Your script should be:

echo "aaaa" >> /home/sentinel/a.txt

I have tried this my self before posting here .

added line rc.local as


save it and restart your PC.

share|improve this answer
Wonderful. Thanks bro. – Optimus Prime Sep 5 '14 at 8:24
Did you mean . /home/sentinel/ instead of ./home/sentinel/ The first is doing source using an absolute path, the second executes the script by a relative path. – Volker Siegel Sep 5 '14 at 9:25
Do you even bash, bro? – Daniel Standage Sep 5 '14 at 10:32
I just tried this on my computer, and it doesn't seem to work. I copied everything as mentioned here, still didn't work. Any ideas? – IcyFlame May 10 '15 at 22:39
How you are trying ? – Raja May 11 '15 at 2:04

Missing leading / char.


should be

share|improve this answer
Sharp! however, since he is calling the script with bash /home/sentinel/ it works anyway... So he escaped luckily. – Jacob Vlijm Sep 5 '14 at 19:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.