Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Better Script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Better Script
Authored by: sgi_oh_too on Jun 20, '03 01:02:31PM

Hello! this is a revised script that is a bit better
than the aforementioned scripts. If you make
any revisions, please post them here so we can
all benefit. Thanks!

#!/bin/sh

if [ $# -ne 1 ]
then
echo " Usage: newRamDisk.sh <size in MB>"
echo "Example: newRamDisk.sh 20"
exit
fi

if [ $1 -lt 4 ]
then
echo "Error: Size must be greater than or equal to four megabytes"
exit
fi

ramDiskSize=`echo "${1}*2048" | bc`
echo "Allocating $ramDiskSize blocks"
ramDiskPath="/dev/r"`hdid -nomount ram://${ramDiskSize} | awk -F / '{print $3}'`
echo -n "Creating HFS Plus filesystem on $ramDiskPath"
newfs_hfs -v "Ram Disk" $ramDiskPath
echo "Mounting $ramDiskPath"
hdiutil mount $ramDiskPath

exit



[ Reply to This | # ]