SuperCard Shell Essentials

 

Unix to Mac Volume Name

Page history last edited by DCS 3 yrs ago

Unix to Mac Volume Name

Back to: Working With Paths

Using a Metadata query.

Example 1

on mouseup
--Synopis: get Mac name of boot volume using 'mdls"
put "mdls -name kMDItemFSName / | " into cmd
--get file system name metadata
put "sed 1d | " after cmd
--delete header line
put "perl -pe 's/.*x22(.+)x22$/$1:/' | " after cmd
--strip down to string between quotes, append a colon
--(x22=hex escaped quote)
put "perl -pe chomp ; " after cmd
--trim trailing linefeed
get shell(cmd)
--execute commands
alert sheet "Boot disk name:" explain it
--display result
end mouseup

Example 2

Equivalent to example 1, tidy up return in SuperCard.

on mouseup
--Synopis: get Mac name of boot volume using 'mdls"
put "mdls -name kMDItemFSName / ; " into cmd
--get file system name metadata
get shell(cmd)
--execute command
--clean up with SC
set the itemDel to quote
get item 2 of it & ":"
set the itemDel to ","--execute commands
alert sheet "Boot disk name:" explain it
--display result
end mouseup

Top

Comments (0)

You don't have permission to comment on this page.