[App_rpt-users] modified custom nodenames

Bryan D. Boyle bdboyle at bdboyle.com
Wed Aug 19 01:36:08 UTC 2015


wget http://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz

from there, standard build etc, left as exercise to the reader.

--
Bryan
Sent from my iPhone 5...No electrons were harmed in the sending of this message.



> On Aug 18, 2015, at 21:25, Sam Nabkey <sam.nabkey at gmail.com> wrote:
> 
> Bash 3 doesn't support foo=${f2,,}  bash 4 does.  
> 
>> On Tue, Aug 18, 2015 at 6:42 PM, Doug Crompton <doug at crompton.com> wrote:
>> Here is a modified script that I think answers the need for not overwriting existing files in /var/lib/asterisk/sounds/rpt/nodenames
>> 
>> Read the comments! Directories need to be defined! Also I am open to any and all suggestions on improving this. I think it might be a useful script to include in the arm-allstar distributions.
>> 
>> You can call this anything you want to test.. Be sure to make it executable.
>> 
>> # !/bin/bash
>> #
>> #  Originally Created by Marshall Dias
>> #  Modified by Doug, WA3DSP 8/18/2015
>> 
>> # Script to write Calls to /var/lib/asterisk/sounds/rpt/nodenames
>> # which will then be used in place of node numbers. This script
>> # will NOT overwrite exisitng files.
>> #
>> # If you want to start clean and delete all nodename files do
>> #    rm -rf /var/lib/asterisk/sounds/rpt/nodenames/*
>> # or delete just the files you want to replace.
>> # See all comments below
>> 
>> # Set the source directory to the Allstar database on your system.
>> # 'locate astdb.txt'  This file will exist if you are running any of the
>> # images from hamvoip.org or you have installed allmon or lsnodes on
>> # your system. For the BBB and RPi2 it will generally be /var/log/asterisk
>> 
>> SRCDIR=/var/log/asterisk
>> 
>> # Set the destination directory. I recommend a test directory as shown at first.
>> # The final destination would be /var/lib/asterisk/sounds/rpt/nodenames
>> 
>> #DESTDIR=/var/lib/asterisk/sounds/rpt/nodenames
>> DESTDIR=/tmp/nodes
>> 
>> # Definitions of sound file directories
>> 
>> NODENAMES=/var/lib/asterisk/sounds/rpt/nodenames
>> LETTERS=/var/lib/asterisk/sounds/letters
>> NUMBERS=/var/lib/asterisk/sounds/digits
>> STRING=""
>> 
>> while IFS='|' read f1 f2 f3 f4
>> do
>> 
>> echo "Processing Node Number: $f1 - Callsign: $f2"
>> 
>> STRING=""
>> 
>> foo=${f2,,}
>> for (( i=0; i<${#foo}; i++ )); do
>>   char=${foo:$i:1}
>> 
>>                 case ${foo:$i:1} in
>>                 [0-9]*) FILENAME=$NUMBERS/$char.gsm ;;
>>                 "/") FILENAME=$LETTERS/slash.gsm ;;
>>                 "-") FILENAME=$LETTERS/dash.gsm ;;
>>                 [a-z]*|[A-Z]*) FILENAME=$LETTERS/$char.gsm ;;
>>                 esac
>> 
>> STRING="$STRING $FILENAME"
>> done
>> if [ -f "$DESTDIR/$f1.gsm" ]
>>   then
>>     echo "$DESTDIR/$f1.gsm exists - not overwriting"
>>   else
>>     cat $STRING > "$DESTDIR/$f1.gsm"
>> fi
>> done < $SRCDIR/astdb.txt
>> 
>> # End of script
>> 
>> 73 Doug
>> WA3DSP
>> http://www.crompton.com/hamradio
>> 
>> _______________________________________________
>> App_rpt-users mailing list
>> App_rpt-users at ohnosec.org
>> http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
>> 
>> To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button"
>> You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem. 
> 
> _______________________________________________
> App_rpt-users mailing list
> App_rpt-users at ohnosec.org
> http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
> 
> To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button"
> You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.keekles.org/pipermail/app_rpt-users/attachments/20150818/110b037c/attachment.html>


More information about the App_rpt-users mailing list