LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
Search this Thread
Old 07-12-2003, 03:32 PM   #1
Jose Muņiz
Member
 
Registered: Jul 2003
Location: Mexico City
Distribution: Slackware 9.1, SuSE 9.1
Posts: 248

Rep: Reputation: 30
Script Problem - Does not give expected results


I have a program (ML Donkey) that needs to be run from a specific directory where it reads (or creates if they are not there) some configuration files.

For that reason, I cannot add a regular Launcher to my GNOME bar. So I wrote this script:


Code:
 

#! /bin/bash

cd "/home/joseamuniz/mldonkey"
mlnet+gui &
exit 0

Because I want the terminal window to close, I didn't set is as executable but rather execute it by "source mllauncher.sh" In this way, I added a Launcher in my GNOME bar with the command "source mllauncher.sh" (Run in Terminal selected). But it doesn't work. The terminal window opens and closes and MLDonkey never launches. On the other hand, if I run the SAME command I wrote in the GNOME bar in a terminal, it closes itself and launches the program, which is what I expect the script to do.,


What am I doing wrong? Thanks a LOT for your freedback.

Last edited by Jose Muņiz; 07-12-2003 at 07:37 PM.
 
Old 07-12-2003, 04:10 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Make the script executable... don't "source" it. The source command isn't the same thing as executing the script.
 
Old 07-12-2003, 04:15 PM   #3
Jose Muņiz
Member
 
Registered: Jul 2003
Location: Mexico City
Distribution: Slackware 9.1, SuSE 9.1
Posts: 248

Original Poster
Rep: Reputation: 30
I know... but I don't want a child process to be started. because that will mean the terminal will stay open even after the script has been executed. That's why I decided not to make it executable and rather "source" it.

Is my thought wrong?
 
Old 07-12-2003, 10:10 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
When you tell the system to run the script in a shell, then the shell is linked to the script. So, when the script finishes, the shell should go away. I don't think the shell is smart enough to realize "Oh, the script started a new process... I have to wait for it to finish".

It's the same thing as opening a terminal, typing "mozilla &" and then typing exit. Mozilla opens, and the terminal goes away.

At least, that's how it works on my system...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a script to give me the last argument !!! rameshvl Linux - General 18 12-29-2008 01:02 PM
expected unqualified id Shwetha GS Linux - Software 0 10-21-2005 09:42 AM
SMB give me problem... help~~!!! gabriellai Linux - Networking 0 10-29-2004 03:35 AM
i830 problem... results in no X spyderusa11 Fedora - Installation 3 05-23-2004 09:30 PM
Is it possible to give MSDOS commands in Unix script??? gopi_20us Programming 1 02-20-2002 12:48 AM


All times are GMT -5. The time now is 11:33 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration