On Wed, 30 Nov 2016, at 16:49, Bram Geron wrote:
> Perhaps the output of hdiutil attach isn't what you expect. What if you
> put "echo -n $ramdiskpath | xxd" in between?

Awesome protip Bram!

00000000: 2f64 6576 2f64 6973 6b31 2020  /dev/disk1
0000000c: 2020 2020 2020 2020 0920 2020          .
00000018: 2020 2020 2020 2020 2020 2020
00000024: 2020 2020 2020 2020 2020 2020
00000030: 2020 2020 090a                     ..

This was the first solution that occurred to me: 

function ramdisk
         set size (math "$argv[1] * 2097152")
         diskutil eject /Volumes/ramdisk >/dev/null 2>&1
         set ramdiskpath (hdiutil attach -nomount ram://$size | egrep -o
         '^\S+')
         diskutil erasevolume HFS+ ramdisk $ramdiskpath
end

Kurtis' string trim looks even better!

A+
Dave

------------------------------------------------------------------------------
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to