I want to find out what device my file is on so that I can use it in a script. I can get this far:
$ df . Filesystem 512-blocks Used Available Capacity Mounted on /dev/disk0s2 498438976 294369520 203557456 60% /
but this output feels too clumsy; is there a better way than parsing this to get the first 'word' of the second line?
What I really need is something like this so I can pipe it to the next command:
$ somecommand . /dev/disk0s2
How can I achieve this, preferably without resorting to string hacking the 'df' output?