Serial Number
Harald Becker
ralda at gmx.de
Fri May 6 18:13:21 UTC 2011
Hallo David!
> If I can gain access to the serial numbers of the drive, ...
Serial number? ... do you mean the unique block device number? ... sorry
if that may be confusing, a serial number is a strait counting number
(1, 2, 3, ...) for me.
... looks like you are looking for the block device UUID feature ... may
be the blockdev command can give you that information (I do not use this).
> Perhaps a peek into your file might help as I'm also using mdev to
> call an external script for processing.
Sorry, I do not have an ready example for posting. It is just a simple
and well known feature used in other shell programming technics too.
A brief introduction ...
At start of script, read stored variable values like:
[ -f /dev/script/serial_number ] && source /dev/script/serial_number
The variable name file may contain shell variable assignments, like:
my_serial_number=4
That variables my be used in your shell script:
new_name="$base_name$(( ++my_serial_number ))"
... or any other form of shell variable substitution.
At the end of the script, save new/changed variable values for later
retrieval:
echo "my_serial_number=$my_serial_number" >/dev/script/serial_number
That's it. May be modified to fit all types of simple information
passing from one script invocation to next one. Feal free to ask for
details.
--
Harald
More information about the busybox
mailing list