Navigating: Home » Bash » Limiting The Number of Entered Characters In read prompt Limiting The Number of Entered Characters In read prompt Posted on by devsrealm Last Updated on: September 3, 2020 We previously looked at the way we could utilize the read prompts in bash, here is the script we wrote in out last guide: Copy Code Copied Use a different Browser #!/bin/bash read -p "What is Your Name? " name echo "Your Name is $name" exit 0 What if we do something as follows: Copy Code Copied Use a different Browser #!/bin/bash read -p "What is Your Name? " name echo "Your Name is $name" read -n1 -p "Press any key to exit " echo exit 0 Now, when the script displays the name, it will pause until you press any key, this is possible by using the -n option followed by an integer, in this case, we specify it to accept just 1 character. Related posts:Iterating With Loops (Bash)Understanding The Four (4) Ways Command-Line Runs Shell ScriptCreating Conditional Statements Using if And Else (Bash)