Results 1 to 6 of 6

Thread: Shell/Bash Script

  1. #1
    Join Date
    Oct 2012
    Beans
    74
    Distro
    Ubuntu

    Shell/Bash Script

    I have made a shell script with a wait function. When i click run in terminal the terminal comes up for 0.1 ish seconds and then goes, can someone tell me how to fix this. It has'nt done it before?

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,651
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Shell/Bash Script

    Hi starwars29.

    This keeps the terminal open for 5 seconds.
    Code:
    #!/bin/bash
    sleep 5
    Could you post your script?
    Regards.

  3. #3
    Join Date
    Oct 2012
    Beans
    74
    Distro
    Ubuntu

    Re: Shell/Bash Script

    Code:
    echo My text
    wait 1
    echo My text
    wait 5

  4. #4
    Join Date
    Oct 2012
    Beans
    74
    Distro
    Ubuntu

    Re: Shell/Bash Script

    I just tried it with #!/bin/bash at the top as well.

  5. #5
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,651
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Shell/Bash Script

    Thanks.

    'wait' it is not a pause command, use sleep instead:
    Code:
    #!/bin/bash
    echo My text
    sleep 1
    echo My text
    sleep 5
    Let us know how it goes.

    P.S.: 'wait' is used to wait for commands that have been sent to the background. It takes optional arguments, but not seconds (process ids actually).

  6. #6
    Join Date
    Oct 2012
    Beans
    74
    Distro
    Ubuntu

    Re: Shell/Bash Script

    Oops I forgot it was sleep. I was thinking of Lua.

Bookmarks

Posting Permissions

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