How to make a .sh script automatically run in the terminal?How can I start my application in a more...
How to display Aura JS Errors Lightning Out
How to denote matrix elements succinctly?
How could Tony Stark make this in Endgame?
How to stop co-workers from teasing me because I know Russian?
Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?
How to fry ground beef so it is well-browned
Why did C use the -> operator instead of reusing the . operator?
Is Diceware more secure than a long passphrase?
What is causing the white spot to appear in some of my pictures
A Note on N!
As an international instructor, should I openly talk about my accent?
Why must Chinese maps be obfuscated?
Can SQL Server create collisions in system generated constraint names?
Rivers without rain
Mistake in years of experience in resume?
Can I criticise the more senior developers around me for not writing clean code?
"The cow" OR "a cow" OR "cows" in this context
How come there are so many candidates for the 2020 Democratic party presidential nomination?
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
Was there a shared-world project before "Thieves World"?
Critique of timeline aesthetic
How to have a sharp product image?
Check if a string is entirely made of the same substring
Can we say “you can pay when the order gets ready”?
How to make a .sh script automatically run in the terminal?
How can I start my application in a more convenient way?How to run shell script via terminalRunning a shell script automaticallyRun script full screen in terminalRun script in Terminal via context menu (Open with Terminal)?Deskop entry which starts .sh script, closing terminalHow can I run a script when click on soft-link to directory on other partition?run virtualenv in new terminal tab automaticallycustomized shell script can not be runRun script defined in PATH location in the current shellHow you do you create a bash script that will run automatically when Unity startups as a user instead of root?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
How do I make a Shell Script that when doube-clicked automatically runs in the terminal? In other words: I am too lazy to constantly do
cd Desktop
chmod +x myscript.sh
./myscript.sh
, so is there any way to auto open the terminal for a bash script?
bash scripts
New contributor
add a comment |
How do I make a Shell Script that when doube-clicked automatically runs in the terminal? In other words: I am too lazy to constantly do
cd Desktop
chmod +x myscript.sh
./myscript.sh
, so is there any way to auto open the terminal for a bash script?
bash scripts
New contributor
If youchmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh,chmod +x
, then in my preferredpcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i usethunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)
– guiverc
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & usingnautilus
, and it's doing whatthunar
did on my 19.04 box (opened in an editor;gedit
probably in your case & it was something else in mine). I openednautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I trieddolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)
– guiverc
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago
add a comment |
How do I make a Shell Script that when doube-clicked automatically runs in the terminal? In other words: I am too lazy to constantly do
cd Desktop
chmod +x myscript.sh
./myscript.sh
, so is there any way to auto open the terminal for a bash script?
bash scripts
New contributor
How do I make a Shell Script that when doube-clicked automatically runs in the terminal? In other words: I am too lazy to constantly do
cd Desktop
chmod +x myscript.sh
./myscript.sh
, so is there any way to auto open the terminal for a bash script?
bash scripts
bash scripts
New contributor
New contributor
New contributor
asked 16 hours ago
Axolotl101Axolotl101
261
261
New contributor
New contributor
If youchmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh,chmod +x
, then in my preferredpcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i usethunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)
– guiverc
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & usingnautilus
, and it's doing whatthunar
did on my 19.04 box (opened in an editor;gedit
probably in your case & it was something else in mine). I openednautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I trieddolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)
– guiverc
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago
add a comment |
If youchmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh,chmod +x
, then in my preferredpcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i usethunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)
– guiverc
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & usingnautilus
, and it's doing whatthunar
did on my 19.04 box (opened in an editor;gedit
probably in your case & it was something else in mine). I openednautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I trieddolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)
– guiverc
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago
If you
chmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh, chmod +x
, then in my preferred pcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i use thunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)– guiverc
16 hours ago
If you
chmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh, chmod +x
, then in my preferred pcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i use thunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)– guiverc
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & using
nautilus
, and it's doing what thunar
did on my 19.04 box (opened in an editor; gedit
probably in your case & it was something else in mine). I opened nautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I tried dolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)– guiverc
15 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & using
nautilus
, and it's doing what thunar
did on my 19.04 box (opened in an editor; gedit
probably in your case & it was something else in mine). I opened nautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I tried dolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)– guiverc
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago
add a comment |
1 Answer
1
active
oldest
votes
You could create a launcher for the script. You would be able to run the script from the activities menu in GNOME (click it) and from the directory the file is saved in. This would be a .desktop file. e.g. Example.desktop:
[Desktop Entry]
Name=Example
Exec=/path/to/executable_script
StartupNotify=true
Terminal=true
Type=Application
Icon=/optional/path/to/icon.png
Make the file executable. When placed in /usr/share/applications or ~/.local/share/applications, GNOME will add the .desktop file to the activities menu.
Now you just have to click the launcher in the activities menu and your script will run. The terminal will close after the script has run to its end.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Axolotl101 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1138349%2fhow-to-make-a-sh-script-automatically-run-in-the-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could create a launcher for the script. You would be able to run the script from the activities menu in GNOME (click it) and from the directory the file is saved in. This would be a .desktop file. e.g. Example.desktop:
[Desktop Entry]
Name=Example
Exec=/path/to/executable_script
StartupNotify=true
Terminal=true
Type=Application
Icon=/optional/path/to/icon.png
Make the file executable. When placed in /usr/share/applications or ~/.local/share/applications, GNOME will add the .desktop file to the activities menu.
Now you just have to click the launcher in the activities menu and your script will run. The terminal will close after the script has run to its end.
add a comment |
You could create a launcher for the script. You would be able to run the script from the activities menu in GNOME (click it) and from the directory the file is saved in. This would be a .desktop file. e.g. Example.desktop:
[Desktop Entry]
Name=Example
Exec=/path/to/executable_script
StartupNotify=true
Terminal=true
Type=Application
Icon=/optional/path/to/icon.png
Make the file executable. When placed in /usr/share/applications or ~/.local/share/applications, GNOME will add the .desktop file to the activities menu.
Now you just have to click the launcher in the activities menu and your script will run. The terminal will close after the script has run to its end.
add a comment |
You could create a launcher for the script. You would be able to run the script from the activities menu in GNOME (click it) and from the directory the file is saved in. This would be a .desktop file. e.g. Example.desktop:
[Desktop Entry]
Name=Example
Exec=/path/to/executable_script
StartupNotify=true
Terminal=true
Type=Application
Icon=/optional/path/to/icon.png
Make the file executable. When placed in /usr/share/applications or ~/.local/share/applications, GNOME will add the .desktop file to the activities menu.
Now you just have to click the launcher in the activities menu and your script will run. The terminal will close after the script has run to its end.
You could create a launcher for the script. You would be able to run the script from the activities menu in GNOME (click it) and from the directory the file is saved in. This would be a .desktop file. e.g. Example.desktop:
[Desktop Entry]
Name=Example
Exec=/path/to/executable_script
StartupNotify=true
Terminal=true
Type=Application
Icon=/optional/path/to/icon.png
Make the file executable. When placed in /usr/share/applications or ~/.local/share/applications, GNOME will add the .desktop file to the activities menu.
Now you just have to click the launcher in the activities menu and your script will run. The terminal will close after the script has run to its end.
answered 14 hours ago
jeroenjeroen
1,527916
1,527916
add a comment |
add a comment |
Axolotl101 is a new contributor. Be nice, and check out our Code of Conduct.
Axolotl101 is a new contributor. Be nice, and check out our Code of Conduct.
Axolotl101 is a new contributor. Be nice, and check out our Code of Conduct.
Axolotl101 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1138349%2fhow-to-make-a-sh-script-automatically-run-in-the-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you
chmod +x
a file, as long as the file system can store the data correctly (ie. a native file-system), the execute permission will be set, and double-clicking on the file will attempt execute. I just created a file.sh,chmod +x
, then in my preferredpcmanfm-qt
a double-click of it asks if I want to run in terminal (I answer yes & it runs). If i usethunar
(my second favorite) it'll open in an editor -- using a different file manager may be all you need. (note: I'm using pcmanfm-qt & thunar as examples; I'm running Lubuntu, but also like Xubuntu - hence those choices)– guiverc
16 hours ago
@guiverc What? I did chmod+x and it just opens the text editor. I have Ubuntu 18.04.1 LTS.
– Axolotl101
16 hours ago
Using standard Ubuntu 18.04 LTS you'll likely be running GNOME & using
nautilus
, and it's doing whatthunar
did on my 19.04 box (opened in an editor;gedit
probably in your case & it was something else in mine). I openednautilus
(Files it is called within gnome menus) & I didn't see any way to make nautilus do what you want (but I'm not a gnome person, so rarely use it & others may have ideas I've not discovered if you wait). My answer was to try another File.Manager/File.Browser. I trieddolphin
and it too has a "Run in Konsole" option (Konsole is the KDE terminal)– guiverc
15 hours ago
Possibly related: How can I start my application in a more convenient way?
– steeldriver
15 hours ago