user3476633
user3476633

Reputation: 11

Automatically open terminal when running bash script

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

Upvotes: 0

Views: 1806

Answers (1)

Rahul
Rahul

Reputation: 77866

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?

Upvotes: 1

Related Questions