Created
February 6, 2016 21:45
-
-
Save tgck/57bb19af64cc62b4a3ac to your computer and use it in GitHub Desktop.
[osc][oscsend] パイプからoscsend
This file contains hidden or 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 | |
ADDRESS="127.0.0.1" | |
PORT="1234" | |
TAG="/foo/message1" | |
TYPE="" | |
function usage() { | |
echo " Usage: echo message | ${0} " | |
echo " or : ${0} << (here document) " | |
exit | |
} | |
while read l ; do | |
args=$l; | |
#declare -p args | |
for i in $args | |
do | |
if [[ $i =~ ^[0-9]+$ ]] ; then | |
TYPE=${TYPE}i | |
elif [[ $i =~ ^[0-9]+\.[0-9]+$ ]] ; then | |
TYPE=${TYPE}f | |
elif [[ $i =~ [a-zA-Z] ]] ; then | |
TYPE=${TYPE}s | |
fi | |
done | |
echo oscsend $ADDRESS $PORT $TAG $TYPE $l | sh; | |
#echo oscsend $ADDRESS $PORT $TAG $TYPE $l; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment