#!/bin/sh # This is probably the most accurate way to get the boot/system name: #diskutil info / | grep "Volume Name" | sed -e 's/.*Volume Name:[ \t]*//' # But this is the fastest way: bootname=`\ls -l /Volumes | egrep ' -> /$' | cut -c50- | sed -e 's/ ->.*//'` # Add some text and date info: loginText="Booted from $bootname\n"`date "+on %m/%d/%Y at %r"` # Don't use the "-string" argument if $loginText contains escape or special characters # (like a newline!), since that will cause the literal characters to get stored # (e.g., "\\n" instead of "\n"). defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "$loginText"