Created
July 4, 2015 20:02
-
-
Save vgmoose/028bb1346b09d4b1a695 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
if [ "$#" -ne 1 ] | |
then | |
echo "Usage: ramdisk size_in_MB" | |
exit 1 | |
fi | |
if [[ $OSTYPE == *"linux"* ]] | |
then | |
mkdir /mnt/ramdisk | |
mount -t tmpfs -o size=$1m tmpfs /mnt/ramdisk | |
fi | |
if [[ $OSTYPE == *"darwin"* ]] | |
then | |
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://$(($1*2048))` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment