Find the answer to your Linux question:
Results 1 to 9 of 9
I know the & character can be tagged after an application name to keep the shell prompt (perhaps this opens the app in a new session). However I am not ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    May 2005
    Posts
    127

    Using the & command to launch an application and keep the shell


    I know the & character can be tagged after an application name to keep the shell prompt (perhaps this opens the app in a new session). However I am not sure how to use this when the app has parameters after it.

    For instance, I'm trying to do:
    Code:
    pppd dial mymodem
    while keeping my shell usable, however niether
    Code:
    pppd & dial mymodem
    nor
    Code:
    pppd dial mymodem &
    work. Anyone know the correct syntax to do this?

    Thanks.

  2. #2
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817
    If I do
    Code:
    # gedit /etc/inittab &
    it works like I would expect: gedit starts per the argument and the terminal is available once gedit is launched. Maybe pppd doesn't want to play that way....
    /IMHO
    //got nothin'
    ///this use to look better

  3. #3
    Just Joined!
    Join Date
    Jun 2005
    Location
    San Francisco, CA
    Posts
    54

    Re: Using the & command to launch an application and keep the shell

    Quote Originally Posted by ngmlinux
    I know the & character can be tagged after an application name to keep the shell prompt (perhaps this opens the app in a new session).
    What it does is that it runs the command in the background. I think you can get the command back into the foreground (and tying up your shell session) with the fg (foreground) command.

  4. #4
    Linux Newbie
    Join Date
    May 2005
    Posts
    127
    Are you suggesting I try something like
    Code:
    pppd & fg dial mymodem
    ?

  5. #5
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817
    The ampersand (&) should be at the end of the command. You can translate the '&' to mean "and do (the preceding command) in the background". You do not want "fg" in your command line: that's used only when you want to bring the process (the one you started with "the preceding command") back to the foreground.

    Of course the command itself has to be right: if you run 'pppd dial mymodem', do you get the correct results? If so, then I guess you want to enter 'pppd dial mymodem &'. If you don't get the correct results without the '&', you need to look at your command first.

    http://linux.about.com/od/glossary/l..._bgprocess.htm
    /IMHO
    //got nothin'
    ///this use to look better

  6. #6
    Just Joined!
    Join Date
    Jun 2005
    Location
    San Francisco, CA
    Posts
    54
    That's right (what drakebasher said).

  7. #7
    Linux Newbie
    Join Date
    May 2005
    Posts
    127
    Command itself runs fine, but doesn't when I add the & to the end.

  8. #8
    Just Joined!
    Join Date
    Jun 2005
    Location
    San Francisco, CA
    Posts
    54
    What happens wrong when you run the command with the & ?

  9. #9
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    pppd updetach dial mymodem

    Try that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •