Find the answer to your Linux question:
Results 1 to 2 of 2
I would like to start a console window which invokes bash and have bash execute a bash command ( 'source' ) and then remain open for further user input ( ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2006
    Posts
    10

    Running 'bash' question


    I would like to start a console window which invokes bash and have bash execute a bash command ( 'source' ) and then remain open for further user input ( be interactive ). I imagine this must be possible. How would I do this ?

    I know I can add the command to ~/.bashrc but I do not want to have the command execute each time I run a script, but only during a particular console session.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    i would use screen for this, e.g.:

    Code:
    screen -dm test.sh
    that will launch a screen session and run your script in it. when the script is done running, you will still have the bash prompt running in the screen session.

    After you've launched the screen session, run this to show running screens:
    Code:
    screen -ls
    you'll see something like:
    Code:
    There is a screen on:
            17656.test.sh   (Detached)
    1 Socket in /var/run/screen/S-user.
    There is one screen running, pid 17656. To attach to it, run:
    Code:
    screen -r 17656
    To detach from a running terminal, use the key sequence Ctrl+A then D.

Posting Permissions

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