| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On 4/26/04 4:44 PM, email@hidden wrote:
Is there a unique identifier for a disk that is not the startup disk
and that would persist over restarts so that an AppleScript script
referring to the disk would work as expected even if the name of the
disk changes?
Yes, via unique UNIX identifier from which one can then obtain the
User editable Volume Name.
'df | grep '/dev/'| awk '{print $1}'' - via 'Terminal', or
do shell script ("df | grep '/dev/' | awk '{print $1}'") - via
AppleScript's 'Script Editor' will display the UNIX low level
assignment of each mounted Volume.
Will the identifier stay the same across restarts? For example, if the
device file name in the /dev directory representing a volume is "disk0s10",
will this be the same each time the machine is restarted?
Replacing '$1' with '$6' will instead display the User's editable
Name of the mounted Volume(s).
Using '$6' captures the path (not the name) and then only up to the first
word of a disk name if there are spaces in the name. For example, if the
name of the disk is "OS X", the syntax returns "/Volumes/OS" for that line.
One could get the disk name associated with "disk0s10" (and eliminate the
grep pipe) using the following:
df | awk -F/ '/disk0s10/ {print $5}'
However, getting the disk name this way is not of much use unless the
associated device file name in the /dev directory is unique across restarts.
Does anyone know if this is the case?
-Jeffrey Berman
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.