Coffeehouse Post

Single Post Permalink

View Thread: One of the million reasons why Windows sucks (religious)
  • User profile image

    Thanks, Jeff.

    I expect the VB script to be 100 lines at least. Actually I don't need this script in my job, and the reason I was asking is rather theoretical. And yes, I'm interested in knowing as much as possible what Longhorn's scripting will look like.

    Now, here is the UNIX answer (or one of the possible answers):

        while read t
            user=`echo $t|cut -f1 -d':'`
            gecos=`echo $t|cut -f5 -d':'`
            sed "s/%FULL_NAME%/$gecos/" MSG | mail $user
        done < /etc/passwd

    (awk would also do this job pretty well.)

    Assuming the template is in the file named MSG. Cryptic, not very readable (neither very 'writable' Smiley ), but all in all, it takes a minute to write it. Do you see any interfaces, protocols or whatever else that would require you to look into documentation here? Nope! Only the very basic standard userland tools: 'cut', 'sed' and 'mail'. The rest is part of the shell language.

    Likewise, you solve many everyday administration tasks on UNIX this quickly.