Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You can create a launcher in Gnome that launches the terminal then executes a command. See man gnome-terminal (or man xterm if you prefer). They both have switches to execute code after loading.
As an example, I have shortcuts to ssh to all of my servers. The command looks like this:
can I launch a console with with the script and then execute coomands automatically in that console?
Stop, deep breath, and tell us what you are trying to do exactly...
If you have a running shell script, and you want to open a terminal and do something in it, then here's how:
Code:
#!/bin/bash
# some random code here
xterm -e echo "Here's some text in a xterm\!"
However if someone runs that from outside X it'll crap out cause is won't be able to find the display. If you want to make a script executable, just chmod it:
Code:
chmod a+x /path/to/script.sh
However, with default permissions, most file managers won't run it if double-clicked as that would be a great way to distribute malicious code. Konqueror and Nautilus will both as to Run or Display in a text editor. ROX won't do anything if you have made an association with the mime type.
I already know the chmod stuff, and it's not something in particular I'm talking about it's a program I'm developing with some other poeple in the community. What about launching a binary with a click.. you know in kde it looks like a gear (is an executable file)... and to be specific, it is a binary compiled by a C++ script..
In KDE, as far as I know, the executable does what you expect it to simply because Konqueror is configured to do that. There's no way to say that a file is going to do what you want when it's clicked by someone else on another system, using a different configuration and possibly a different file manager. The best you can do is make it executable and leave it up to the user to decide how to launch it.
autopackages are simply shell scripts that are made +x. Internally, if there is no tty associated then we re-exec the script inside a terminal emulator. Various heuristics are used to determine whether to run xterm, gnome-terminal, konsole or something else. Once the bootstrap procedure has been completed (ie, autopackage is installed) then a fully graphical frontend is available and the shell scripts invoke that instead.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.