advertisement

Article:
  Scripting Mac OS X
Subject:   end-of-line character and sudo
Date:   2003-11-10 13:45:39
From:   jamesreynolds
Response to: end-of-line character and sudo

I prefer "sudo -s" or "sudo /bin/sh" but you can also use "sudo" before each command. That method is the general rule because it is safer, that is, it times out after a few minutes rather than leaving a command line with root access and as mentioned, the system does log each sudo command to /var/log/system.log.


If you were following the tutorial, and you wanted to execute each line in the terminal, you would type:


sudo rm -rf "/Users/labuser"
sudo ditto -rsrcFork "/System/Library/User Template/English.lproj" "/Users/labuser"
sudo chown -R <username>:staff "/Users/labuser"


instead of:


sudo /bin/sh
rm -rf "/Users/labuser"
ditto -rsrcFork "/System/Library/User Template/English.lproj" "/Users/labuser"
chown -R <username>:staff "/Users/labuser"