SuperCard Shell Essentials

 

Getting Unix Volume Names

Page history last edited by DCS 3 yrs ago

Getting Unix Volume Names

Back to: Working With Paths

All volumes:

Example 1

on mouseup
--Synopsis: list unix path names of non-boot volumes using 'ls -F
put "ls -F /Volumes | " after cmd
--get name list
put "grep -E '/$' ; " after cmd
--strip down to regular directory entries
get shell(cmd)
--execute commands
alert sheet "Non-boot volumes:" explain it
--display result
end mouseup

Top

Example 2

on mouseup
--Synopsis: list unix path names of non-boot volumes using 'ls -l'
put "ls -l /Volumes | " after cmd
--list aliases within '/Volumes' directory
put "sed 1d | " after cmd
--strip header
put "grep -Ev '/$' | " after cmd
--boot volume entry ends with string ' -> /'
--strip away boot volume entry
put "perl -pe 's/.*:dd (.+)$//Volumes/$1/' ; " after cmd
--strip columns down to volume name only, prepending '/Volumes/'
get shell(cmd)
--execute commands
alert sheet "Non-boot volume pathnames:" explain it
--display result
end mouseup

Top

Local volumes

on mouseup
--Synopsis: get list of local (non-boot) volume path names using 'mount'
put "mount | " into cmd
--get list of mounted volumes
put "grep  '/dev/disk' | " after cmd
--exclude afp volumes and others
put "perl -pe 's|.* /Volumes/(.+) (.*|/Volumes/$1|g' | " after cmd
--trim 'mount' info to human readable volume names
--skips boot volume
put "grep -v '/dev/disk' ; " after cmd
--exclude boot volume
get shell(cmd)
alert sheet "Local volumes :" explain it
end mouseup

Top

Afp mounts

on mouseup
--Synopsis: get volume path names of afp mounts using 'mount'
put "mount | " into cmd
--get list of mounted volumes
put "grep  '^afp_' | " after cmd
--exclude non afp volumes
put "perl -pe 's|.* /Volumes/(.+) (.*|/Volumes/$1|g' ; " after cmd
--trim 'mount' info to human readable volume names
--skips boot volume
get shell(cmd)
--execute commands
alert sheet "Afp volumes :" explain it
end mouseup

Top

Comments (0)

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