Languages
[Edit]
EN

Bash - shell sh script with do not close terminal which works like windows bat pause

7 points
Created by:
Root-ssh
6266

Bash - shell sh script with pause

We can use linux read command to pause bash script.

read

Working example:

#!/bin/sh

# print to console
echo 'Hello World'

echo 'Will wait until user press Enter'

# will wait until user press Enter
read

Filename: 

pause_bash_sh_script.sh
Bash - shell sh script with do not close terminal which works like windows bat pause
Bash - shell sh script with pause

NOTE about linux read command

read - Read a line from the standard input and split it into fields.

References

  1. Linux read command - manual page
  2. Read command wikipedia

Checkout latest findings & news:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Rockstar community members
Thank you for great work 👍