Created
September 14, 2023 00:37
-
-
Save joelagnel/254cd2e7ddebd4b1434c0ccbe01e6fce to your computer and use it in GitHub Desktop.
Script to ignore stdin for a $1 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Check if at least one numeric arg is passed | |
if [ $# -eq 0 ] | |
then | |
echo "Usage: $0 <seconds>" | |
exit 1 | |
fi | |
# Read and discard input for 1 second | |
timeout $1 cat > /dev/null | |
# Read and print the rest of the input | |
cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment