To get the script to run in terminal, I have to select the option to open in terminal and write sh script name.shIs there a way I can reduce that to a single step, i.e. a launcher that automatically opens the script in a terminal after logging as a root ? I've tried to look it up on Google, but I haven't found any useful advice (perhaps I'm not executing the search properly).
-
you mean running the script as start up script.Rahul– Rahul2014-03-29 21:02:48 +00:00Commented Mar 29, 2014 at 21:02
-
I mean to run it after logging inuser3476633– user34766332014-03-29 21:06:44 +00:00Commented Mar 29, 2014 at 21:06
-
Yep, that's it. See my answer below.Rahul– Rahul2014-03-29 21:07:51 +00:00Commented Mar 29, 2014 at 21:07
-
Is that ok with bash ??user3476633– user34766332014-03-29 21:10:35 +00:00Commented Mar 29, 2014 at 21:10
-
see my edited answer and yes it's ok for bash.Rahul– Rahul2014-03-29 21:16:11 +00:00Commented Mar 29, 2014 at 21:16
Add a comment
|
1 Answer
I think what you mean is running your script as start up script. In that case place the script you want to run in the /etc/init.d directory and make the script executable with command chmod 755 scriptname.sh.
See the below related threads for more information
https://askubuntu.com/questions/290099/how-to-run-a-script-during-boot-as-root
How to run a shell script at startup
EDIT:
if you want to run your script after your login is successful then you need to place your script in ~/.bash_profile. See this related post
7 Comments
Rahul
I mean include your script path there (OR) call your script from
bash_profileRahul
bash_profile itself is a script. So you just need to call your script from there like /bin/bash /path/scriptname.sh.Rahul
@user3476633, if this answer helped you then try accepting it as answer.
user3476633
I know you did your best but nothing happened when editing the bash profile ... I edit it by "nano ~/.bash_profile and nothing happen
Rahul
What did you added in the file. show the excerpt from bash_profile.
|