[arm-allstar] syntax to load a variable via dtmf
Doug Crompton
doug at crompton.com
Thu Apr 28 22:22:18 EST 2016
Neil,
No you can't do it that way. You can call a script and then write a variable but that variable will only be active within that script unless you export it and then only to child processes. Why do you want to write a variable? It would be much easier and more understandable to write to a file. Then it would be visible at any point down the line unless you deleted it or rebooted.
If you do write to a file always write to a tmpfs (ramdisk) like /tmp. We use /tmp for many temporary writes within the code. This avoids any writes to the SD card. Below is an example. This can be done many ways but you need to understand bash scripting etc. Also I would not use simple variable names like I show here but rather full meaningful names so it does not possibly clash with something else. This just copies a value "12" from one variable 'A' to 'B' Where it is written and read could be completely different scripts executed at different times.
[root at alarmpi ~]# A="12"
[root at alarmpi ~]# echo $A > /tmp/delete.me
[root at alarmpi ~]# B=`cat /tmp/delete.me`
[root at alarmpi ~]# echo $B
12
When you are done it is good practice to remove the file unless you are going to use it again.
[root at alarmpi ~]# rm /tmp/delete.me
rm: remove regular file '/tmp/delete.me'? y
removed '/tmp/delete.me'
73 Doug
WA3DSP
http://www.crompton.com/hamradio
To: arm-allstar at hamvoip.org
Date: Thu, 28 Apr 2016 20:04:19 -0400
Subject: Re: [arm-allstar] syntax to load a variable via dtmf
From: arm-allstar at hamvoip.org
CC: k8it at cac.net
Without calling a script to write the variable
could I do something like
82=cmd,/temp/xyz.txt='A'
without using a script?
or is a short script to read $ and then write the temporary
variable
Thanks
73 Neil Sablatzky K8IT
Allstar Node 41838
KITLINK
Allstar Node 42087 KITLINK HUB
IRLP Node exp0068
Echolink
K8IT-L
WIRES-X K8IT 11479 Room 21479
From: Doug Crompton via arm-allstar
Sent: Thursday, April 28, 2016 12:45 AM
To: ARM Allstar
Cc: Doug
Crompton
Subject: Re: [arm-allstar] syntax to load a variable via
dtmf
Neil,
I am
not sure what you are asking "load a variable" Do you mean pass a
variable? Here is an example from the rpt.conf file for 24 hour time
-
82=cmd,/usr/local/sbin/say24time.pl 27225
When *82 is sent it
runs the file say24time.pl and passes the variable 27225, the node number
to say the time on. This would be the same as typing - say24time.pl 27225
at the Linux prompt.
The path and file could be anything available on
your system and you could pass multiple variables if desired. The variables are
returned differently in the actual program depending on what language it is. For
bash the above variable would be passed as $1 for Perl as in the example above
it is passed as $ARGV[0]
Is this what you are asking?
73
Doug
WA3DSP
http://www.crompton.com/hamradio
To: arm-allstar at hamvoip.org
Date: Wed, 27 Apr 2016 23:13:35 -0400
Subject:
[arm-allstar] syntax to load a variable via dtmf
From:
arm-allstar at hamvoip.org
CC: k8it at cac.net
I forgot the syntax to load a string variable with a DTMF code
such as
888 = /temp/xyz.txt="P"
Thanks
73 Neil Sablatzky K8IT
Allstar Node 41838
KITLINK
Allstar Node 42087 KITLINK HUB
IRLP Node exp0068
Echolink
K8IT-L
WIRES-X K8IT 11479 Room 21479
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hamvoip.org/pipermail/arm-allstar/attachments/20160428/9580ecde/attachment.html>
More information about the arm-allstar
mailing list