Created
October 6, 2019 18:35
-
-
Save haruo31/807efc37faed2735fb4968ce3c07e961 to your computer and use it in GitHub Desktop.
Find CD information and store into *.cdr image using diskutil information. (extra command xidel is required to work.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diskutil list -plist | | |
xidel --data=- --extract "//*/string[.='CD_partition_scheme']/../*" | | |
awk 'NR % 2 == 1 { printf "%s\t", $0; } NR % 2 == 0 { print $0; }' | | |
IFS=$'\t' while read key value; do | |
case "$key" in | |
"DeviceIdentifier") | |
DEVICE=/dev/${value} | |
;; | |
"VolumeName") | |
VOLNAME="${value}" | |
;; | |
esac | |
hdiutil create -srcdevice ${DEVICE} -format UDTO -ov "${VOLNAME}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment