#!/bin/sh if [ `id -u` != 0 ] ; then #if not already root, call itself as root exec sudo gainroot <<EOF exec sh $0 $* EOF exit $? fi #real script follows chroot /mnt/initfs dsmetest -l 3 exit