-
-
Save rhunter/1495151 to your computer and use it in GitHub Desktop.
bash golf problem
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/bash | |
# Input: | |
# output this 6 | |
# do not output this 5 | |
# | |
# Output (and a non-zero exit code): | |
# output this 6 | |
THRESHOLD=5 | |
cat test_file | | |
ruby -ne "puts \$_ if \$_.split(' ').last.to_i > \"${THRESHOLD}\".to_i" | \ | |
ruby -e 'out = STDIN.read; puts out; exit(1) if out.length > 0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment