Languages
[Edit]
EN

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

7 points
Created by:
Root-ssh
68500

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
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join