Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
I'm making the transition from Windows to Linux (Mandrake 9.2). Right now I'm trying to make a script I can doubleclick from my linux desktop that opens a console window (konsole) and then issues a command (defined in the script) to this window. In Win(DOS) this would require a batch file with a wait statement (to prevent the command prompt from closing after the command was issued). In Linux my script works if I type it from within an active Konsole session, but if I click a link from the desktop, or click the file name within its directory from Konqueror nothing seems to happen. If I make the script executable I get the error 'Couldn't find the program <myscriptname.sh>'.
Is what I'm trying possible from a script or am I taking the wrong approach?
Type man konsole or read the available HTML documentation for it. Most or all xshells support a switch for executing a program within the xshell. aterm -e irssi will for instance launch an aterm with the irssi IRC client, and when irssi exits, the shell closes.
If you are creating a shellscript you need the first line to be #!/bin/bash or #!/bin/sh to indicate you want bash to interpret it, that's why you get the "Can't find..." error.
Thanks for the quick help, but I'm afraid I do not quite understand your answer. Perhaps my question was a bit to vague. The script I've written looks as follows:
ucc-bin server <long list of parameters>
if I execute this script from the console it works fine, if I execute it from a link within the KDE desktop it doesn't work because the console won't open. Is there a way to get the console to open, or is this impossible?
yes there is, but do you need the console to be open? do you need to interact with this ucc-bin server thing?
Method one would be to copy a icon from your toolbar, right-click on it and change all the properties to the one you need. (or right-click on the desktop and select create new:file:link to application) Open program in konsole should be one of them.
The other way is to call konsole directly in your script like this:
konsole --vt_sz 80x40 -e telnet $ip &
which opens a new konsole and telnets into the appropriate host.
(BTW never use telnet when you don't absolutely have to, use shh instead)
check with kde if it will actually execute shellscripts and not just open them in a textviewer.
(for those who care) My final script looks like this:
konsole --vt_sz 80x40 -noclose --workdir /home2/ut2004/System/ -e ucc-bin <long list of parameters>
- e executes my ucc-bin file
- noclose prevents the console from shutting down
- workdir makes sure ucc-bin can find the other files it needs while running
I placed the file in the System directory and created a link to the desktop to start it. It works perfectly now. I need the console to remain open because the 'ucc-bin server thing' runs a dedicated game server as long as it is open, which I can terminate by closing the console (so without a console that remains open, the server closes down directly after starting it (at least I think it does))