Created
September 25, 2018 19:02
-
-
Save EduardoOliveira/8c5ac3e861420e3bfc63e7cf0d267968 to your computer and use it in GitHub Desktop.
tool to open multiple urls or do multiple files
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 | |
total=0 | |
counter=0 | |
cmd="${1:-"xdg-open"}" | |
while read line | |
do | |
if [ -z "$line" ] ;then | |
counter=$((counter+1)) | |
else | |
counter=0 | |
`$cmd $line` &> /dev/null | |
total=$((total+1)) | |
fi | |
if [ $counter -ge 2 ] ;then | |
echo "$total actions taken" | |
exit | |
fi | |
done < /dev/stdin | |
echo "$total actions taken" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment