Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Scripting Mac OS X
Subject:   end-of-line character and sudo
Date:   2003-11-08 08:28:48
From:   hayne
A small correction:
The end-of-line-character in UNIX is ASCII 10 - not 8 as reported in the article. (man ascii)


And a recommendation:
The article suggested using 'sudo /bin/sh' in order to run a script as root. It would be better to use 'sudo' instead. You could do 'sudo name-of-script' and it would run as root. The use of 'sudo' for individual commands/scripts is generally recommended instead of running a shell as root. This limits exposure to problems and has the side benefit that everything you do is logged.

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • end-of-line character and sudo
    2003-11-10 13:45:39  jamesreynolds [View]

    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"
  • end-of-line character and sudo
    2003-11-10 11:46:25  anonymous2 [View]

    The incorrect end-of-line-character in UNIX ASCII 10 has been fixed in the article.
    • end-of-line character and sudo
      2004-01-01 13:34:15  anonymous2 [View]

      No, it still says 8.