[rrd-users] RRDTOOL Update with script in string

Simon Hobson linux at thehobsons.co.uk
Sat Jan 16 11:53:20 CET 2016


Tony Mountifield <tony at mountifield.org> wrote:

>> # Get the file
>> Utmp=$( < /home/pi/net/devices.csv )
>> 
>> # Get everything after the 12th ','
>> Utmp=$(Utmp#*,*,*,*,*,*,*,*,*,*,*,*,)
> 
> Always dangerous to type suggestions on the fly without testing!
> (been there, done that)
> 
> I think you mean ${ ... } not $( ... ), and similarly on the next two.

Just testing to see if anyone is paying attention ;-)

Yes, some of those () should be {}. The first line is correct using the $(...) to run a command in a sub-shell. After that it should be ${...} for value substitution.

Every code example should have at least one error - it teaches more is someone has to work out what's wrong and fix it :D


As an aside, it's said that every Meccano instruction leaflet had at least one error for that reason. Ie, the kit could not be build by following the instructions to the letter (or image as they are pictorial), so the user has to apply some thinking for themselves.
Wikipedia says that those involves say they were accidental errors.
https://en.wikipedia.org/wiki/Meccano#Capabilities



More information about the rrd-users mailing list