Skip to content

Instantly share code, notes, and snippets.

@EduardoOliveira
Created September 25, 2018 19:02
Show Gist options
  • Save EduardoOliveira/8c5ac3e861420e3bfc63e7cf0d267968 to your computer and use it in GitHub Desktop.
Save EduardoOliveira/8c5ac3e861420e3bfc63e7cf0d267968 to your computer and use it in GitHub Desktop.
tool to open multiple urls or do multiple files
#!/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