Languages
[Edit]
EN

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

7 points
Created by:
Root-ssh
175400

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

Alternative titles

  1. Bash - pause script executing / sleep / wait until press enter
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Bash

Bash - shell sh script with do not close terminal (like windows bat pause)
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join