How can I start my application in a more convenient way?How do I run executable scripts in Nautilus?How to make a file (e.g. a .sh script) executable, so it can be run from terminalHow do I create a script file for terminal commands?Open Any file with specific Program?How to associate all file types within Wine with its corresponding native application?Help or advice for my scriptScript to quit and restart nautilus doesn't workThere was an error creating the child process for this terminalHow to run perl script in backgroundHow to start GUI application with upstart?making a bash script executable programaticallyHow can I run a script when the power supply is plugged-in or -out?Find and Rename recursively in folders, subfolders and multiple filesHow do I check if I can safely install something with apt during a bash script?
I Accidentally Deleted a Stock Terminal Theme
Is it legal for company to use my work email to pretend I still work there?
Can a rocket refuel on Mars from water?
Why doesn't H₄O²⁺ exist?
How to draw the figure with four pentagons?
Can I make "comment-region" comment empty lines?
SSH "lag" in LAN on some machines, mixed distros
Took a trip to a parallel universe, need help deciphering
Arrow those variables!
Why do I get two different answers for this counting problem?
Blender 2.8 I can't see vertices, edges or faces in edit mode
Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?
Why is Collection not simply treated as Collection<?>
How could indestructible materials be used in power generation?
Reserved de-dupe rules
What reasons are there for a Capitalist to oppose a 100% inheritance tax?
How to model explosives?
How do I write bicross product symbols in latex?
How to show the equivalence between the regularized regression and their constraint formulas using KKT
What exploit are these user agents trying to use?
Has there ever been an airliner design involving reducing generator load by installing solar panels?
Why are electrically insulating heatsinks so rare? Is it just cost?
Brothers & sisters
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
How can I start my application in a more convenient way?
How do I run executable scripts in Nautilus?How to make a file (e.g. a .sh script) executable, so it can be run from terminalHow do I create a script file for terminal commands?Open Any file with specific Program?How to associate all file types within Wine with its corresponding native application?Help or advice for my scriptScript to quit and restart nautilus doesn't workThere was an error creating the child process for this terminalHow to run perl script in backgroundHow to start GUI application with upstart?making a bash script executable programaticallyHow can I run a script when the power supply is plugged-in or -out?Find and Rename recursively in folders, subfolders and multiple filesHow do I check if I can safely install something with apt during a bash script?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am new in Ubuntu. I have an application which I open in the following way. I type in the console:
cd ~/MyDirectory
./myapp +some arguments
How can I find a solution, so I could launch my application without typing these commands in the console every time? I am thinking of a script, like a bat-script or .lnk in windows.
In other similar questions I didn't find a solution because there was only some mention and discussion of scripting. I didn't find how I can use "cd" command in other questions, and this question is not duplicate of others I suggest.
scripts
New contributor
add a comment |
I am new in Ubuntu. I have an application which I open in the following way. I type in the console:
cd ~/MyDirectory
./myapp +some arguments
How can I find a solution, so I could launch my application without typing these commands in the console every time? I am thinking of a script, like a bat-script or .lnk in windows.
In other similar questions I didn't find a solution because there was only some mention and discussion of scripting. I didn't find how I can use "cd" command in other questions, and this question is not duplicate of others I suggest.
scripts
New contributor
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago
add a comment |
I am new in Ubuntu. I have an application which I open in the following way. I type in the console:
cd ~/MyDirectory
./myapp +some arguments
How can I find a solution, so I could launch my application without typing these commands in the console every time? I am thinking of a script, like a bat-script or .lnk in windows.
In other similar questions I didn't find a solution because there was only some mention and discussion of scripting. I didn't find how I can use "cd" command in other questions, and this question is not duplicate of others I suggest.
scripts
New contributor
I am new in Ubuntu. I have an application which I open in the following way. I type in the console:
cd ~/MyDirectory
./myapp +some arguments
How can I find a solution, so I could launch my application without typing these commands in the console every time? I am thinking of a script, like a bat-script or .lnk in windows.
In other similar questions I didn't find a solution because there was only some mention and discussion of scripting. I didn't find how I can use "cd" command in other questions, and this question is not duplicate of others I suggest.
scripts
scripts
New contributor
New contributor
edited 2 days ago
rabipelais
11314
11314
New contributor
asked Apr 1 at 13:28
nicknick
1365
1365
New contributor
New contributor
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago
add a comment |
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
A script is quite overkill.
Use a .desktop file like:
[Desktop Entry]
Exec=/bin/bash -c "cd ~/MyDirectory && myapp some_arguments"
Name=Some App
Type=Application
- Save it as
some_app.desktop
- Make it executable and double click
N.B.
The question is if it needs to be run from its own directory or not. If not, the command could even be simpler:
Exec='/home/MyUserName/MyDirectory/myapp' some_arguments
2
Really thank you..desktop
file is enough for this task.
– nick
Apr 1 at 13:52
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your.desktop
file does not do the same as the commands in the question, whenMyDirectory
does not exist.
– allo
Apr 1 at 15:06
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
You might want to write./myapp …
instead of justmyapp …
because the current directory,.
, by default is not part of the PATH variable.
– PerlDuck
2 days ago
|
show 5 more comments
Create a file with following content:
#!/bin/bash
cd ~/MyDirectory
./myapp +some arguments
Then make it executable:
chmod u+x scriptname
Now you can call script like: /pathtoscript/scriptname
Make a shortcut to script, place in in ~/.local/share/applications/ and name like somename.desktop with the following content:
[Desktop Entry]
Version=1.0
Name=Script
Comment=
Keywords=Script
Exec=/pathtoscript/scriptname
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=preferences-system
Categories=GTK;Development;
StartupNotify=false
Then it will appear in applications list
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
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
);
);
nick 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%2f1130354%2fhow-can-i-start-my-application-in-a-more-convenient-way%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
A script is quite overkill.
Use a .desktop file like:
[Desktop Entry]
Exec=/bin/bash -c "cd ~/MyDirectory && myapp some_arguments"
Name=Some App
Type=Application
- Save it as
some_app.desktop
- Make it executable and double click
N.B.
The question is if it needs to be run from its own directory or not. If not, the command could even be simpler:
Exec='/home/MyUserName/MyDirectory/myapp' some_arguments
2
Really thank you..desktop
file is enough for this task.
– nick
Apr 1 at 13:52
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your.desktop
file does not do the same as the commands in the question, whenMyDirectory
does not exist.
– allo
Apr 1 at 15:06
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
You might want to write./myapp …
instead of justmyapp …
because the current directory,.
, by default is not part of the PATH variable.
– PerlDuck
2 days ago
|
show 5 more comments
A script is quite overkill.
Use a .desktop file like:
[Desktop Entry]
Exec=/bin/bash -c "cd ~/MyDirectory && myapp some_arguments"
Name=Some App
Type=Application
- Save it as
some_app.desktop
- Make it executable and double click
N.B.
The question is if it needs to be run from its own directory or not. If not, the command could even be simpler:
Exec='/home/MyUserName/MyDirectory/myapp' some_arguments
2
Really thank you..desktop
file is enough for this task.
– nick
Apr 1 at 13:52
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your.desktop
file does not do the same as the commands in the question, whenMyDirectory
does not exist.
– allo
Apr 1 at 15:06
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
You might want to write./myapp …
instead of justmyapp …
because the current directory,.
, by default is not part of the PATH variable.
– PerlDuck
2 days ago
|
show 5 more comments
A script is quite overkill.
Use a .desktop file like:
[Desktop Entry]
Exec=/bin/bash -c "cd ~/MyDirectory && myapp some_arguments"
Name=Some App
Type=Application
- Save it as
some_app.desktop
- Make it executable and double click
N.B.
The question is if it needs to be run from its own directory or not. If not, the command could even be simpler:
Exec='/home/MyUserName/MyDirectory/myapp' some_arguments
A script is quite overkill.
Use a .desktop file like:
[Desktop Entry]
Exec=/bin/bash -c "cd ~/MyDirectory && myapp some_arguments"
Name=Some App
Type=Application
- Save it as
some_app.desktop
- Make it executable and double click
N.B.
The question is if it needs to be run from its own directory or not. If not, the command could even be simpler:
Exec='/home/MyUserName/MyDirectory/myapp' some_arguments
edited Apr 1 at 16:25
answered Apr 1 at 13:48
Jacob VlijmJacob Vlijm
66k9130228
66k9130228
2
Really thank you..desktop
file is enough for this task.
– nick
Apr 1 at 13:52
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your.desktop
file does not do the same as the commands in the question, whenMyDirectory
does not exist.
– allo
Apr 1 at 15:06
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
You might want to write./myapp …
instead of justmyapp …
because the current directory,.
, by default is not part of the PATH variable.
– PerlDuck
2 days ago
|
show 5 more comments
2
Really thank you..desktop
file is enough for this task.
– nick
Apr 1 at 13:52
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your.desktop
file does not do the same as the commands in the question, whenMyDirectory
does not exist.
– allo
Apr 1 at 15:06
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
You might want to write./myapp …
instead of justmyapp …
because the current directory,.
, by default is not part of the PATH variable.
– PerlDuck
2 days ago
2
2
Really thank you.
.desktop
file is enough for this task.– nick
Apr 1 at 13:52
Really thank you.
.desktop
file is enough for this task.– nick
Apr 1 at 13:52
2
2
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your
.desktop
file does not do the same as the commands in the question, when MyDirectory
does not exist.– allo
Apr 1 at 15:06
You're probably right, but this is not the correct answer to the question. I see this as a problem (not the suggestion itself, but this post being the accepted answer), as some scripts may be longer and the actual answer to "how do I make a sequence of commands a script" is another one. Also note that your
.desktop
file does not do the same as the commands in the question, when MyDirectory
does not exist.– allo
Apr 1 at 15:06
1
1
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
@allo If OP asks for a solution, which isn't the optimal one for his problem, but he isn't aware a better one exists, you should give him the better solution for his problem if you know one. If you don't see that you are quite missing the point on what an answer should be here.
– Jacob Vlijm
Apr 1 at 15:34
1
1
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
@dessert Thanks for the edit. We might have to deal with paths with spaces :)
– Jacob Vlijm
Apr 1 at 16:27
1
1
You might want to write
./myapp …
instead of just myapp …
because the current directory, .
, by default is not part of the PATH variable.– PerlDuck
2 days ago
You might want to write
./myapp …
instead of just myapp …
because the current directory, .
, by default is not part of the PATH variable.– PerlDuck
2 days ago
|
show 5 more comments
Create a file with following content:
#!/bin/bash
cd ~/MyDirectory
./myapp +some arguments
Then make it executable:
chmod u+x scriptname
Now you can call script like: /pathtoscript/scriptname
Make a shortcut to script, place in in ~/.local/share/applications/ and name like somename.desktop with the following content:
[Desktop Entry]
Version=1.0
Name=Script
Comment=
Keywords=Script
Exec=/pathtoscript/scriptname
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=preferences-system
Categories=GTK;Development;
StartupNotify=false
Then it will appear in applications list
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
add a comment |
Create a file with following content:
#!/bin/bash
cd ~/MyDirectory
./myapp +some arguments
Then make it executable:
chmod u+x scriptname
Now you can call script like: /pathtoscript/scriptname
Make a shortcut to script, place in in ~/.local/share/applications/ and name like somename.desktop with the following content:
[Desktop Entry]
Version=1.0
Name=Script
Comment=
Keywords=Script
Exec=/pathtoscript/scriptname
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=preferences-system
Categories=GTK;Development;
StartupNotify=false
Then it will appear in applications list
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
add a comment |
Create a file with following content:
#!/bin/bash
cd ~/MyDirectory
./myapp +some arguments
Then make it executable:
chmod u+x scriptname
Now you can call script like: /pathtoscript/scriptname
Make a shortcut to script, place in in ~/.local/share/applications/ and name like somename.desktop with the following content:
[Desktop Entry]
Version=1.0
Name=Script
Comment=
Keywords=Script
Exec=/pathtoscript/scriptname
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=preferences-system
Categories=GTK;Development;
StartupNotify=false
Then it will appear in applications list
Create a file with following content:
#!/bin/bash
cd ~/MyDirectory
./myapp +some arguments
Then make it executable:
chmod u+x scriptname
Now you can call script like: /pathtoscript/scriptname
Make a shortcut to script, place in in ~/.local/share/applications/ and name like somename.desktop with the following content:
[Desktop Entry]
Version=1.0
Name=Script
Comment=
Keywords=Script
Exec=/pathtoscript/scriptname
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=preferences-system
Categories=GTK;Development;
StartupNotify=false
Then it will appear in applications list
answered Apr 1 at 13:36
LeonidMewLeonidMew
956619
956619
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
add a comment |
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
Your answer is working, thank you. But really sorry, script is too hard, I didn't knew about it. And my answer was concretically in script but not in just finding any way of solution. I will +1 to you.
– nick
Apr 1 at 13:54
add a comment |
nick is a new contributor. Be nice, and check out our Code of Conduct.
nick is a new contributor. Be nice, and check out our Code of Conduct.
nick is a new contributor. Be nice, and check out our Code of Conduct.
nick 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%2f1130354%2fhow-can-i-start-my-application-in-a-more-convenient-way%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
@steeldriver, no, i didn't found solution at this question. there are no anything about cd command and running app via script.
– nick
Apr 1 at 13:35
#1 Do you want the solution to be an icon you can click on your desktop, or will this be something which you need/want to run from the command prompt? #2 How often will the argument change?
– RonJohn
Apr 1 at 22:23
The conversation (safely in this case) assumes there is a desktop. Quite often in the scripting world there will not be.
– mckenzm
2 days ago