Friday, June 10, 2005

Bash string operators

#!/bin/bash

while read foo
do
echo ${foo%%:*}
case ${foo%%:*} in
cm1*) export CM1=${foo##*:};;
esac

done < config.txt

echo $CM1

And the config.txt has syntax like
tunnel_port : 9999

Enjoy :)

0 Comments:

Post a Comment

<< Home