dotfiles/sway/scripts/sanitize_wob

9 lines
161 B
Plaintext
Raw Normal View History

#!/bin/bash
while read IN
do
[[ ! $IN =~ ^[+-]?[0-9]+$ ]] && IN=0
[[ $IN -gt 100 ]] && IN=100
[[ $IN -lt 0 ]] && IN=0
echo $IN
done < "${1:-/dev/stdin}"