Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 3075  / 1 Year ago, mon, march 13, 2023, 1:40:57

I am working on a VM with Lubuntu 14.04,



I have created a script a.sh,



#!bin/bash
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/a.sh
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?


More From » bash

 Answers
4

Mention complete path where a.txt should create.



Your script should be:



#!/bin/bash
echo "aaaa" >> /home/sentinel/a.txt


I have tried this my self before posting here .



added line rc.local as



./home/sentinel/a.sh


save it and restart your PC.


[#23345] Monday, March 13, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alliulet

Total Points: 46
Total Questions: 109
Total Answers: 97

Location: Svalbard and Jan Mayen
Member since Sat, Oct 10, 2020
4 Years ago
;