0

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).

5
  • you mean running the script as start up script. Commented Mar 29, 2014 at 21:02
  • I mean to run it after logging in Commented Mar 29, 2014 at 21:06
  • Yep, that's it. See my answer below. Commented Mar 29, 2014 at 21:07
  • Is that ok with bash ?? Commented Mar 29, 2014 at 21:10
  • see my edited answer and yes it's ok for bash. Commented Mar 29, 2014 at 21:16

1 Answer 1

1

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

How do you run a script on login in *nix?

Sign up to request clarification or add additional context in comments.

7 Comments

I mean include your script path there (OR) call your script from bash_profile
bash_profile itself is a script. So you just need to call your script from there like /bin/bash /path/scriptname.sh.
@user3476633, if this answer helped you then try accepting it as answer.
I know you did your best but nothing happened when editing the bash profile ... I edit it by "nano ~/.bash_profile and nothing happen
What did you added in the file. show the excerpt from bash_profile.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.