cURL / Mailing Lists / curl-users / Single Mail


curl script error

From: Michael Quick <>
Date: Mon, 10 Dec 2007 16:20:10 -0800 (PST)

Grr, I've been bit by the script bug. Just found out the hard way that
you can't use 'su -c' in a script if you are trying to grab it from a
webpage and run it. I get the error "standard in must be a tty". Need
this to work for end-users, any ideas or workarounds? Anyone see this
before ? Thanks in advance.

[quickm@duvel Desktop]$ *curl
  % Total % Received % Xferd Average Speed Time Time Time
                                 Dload Upload Total Spent Left
100 4313 100 4313 0 0 36125 0 --:--:-- --:--:--
checking credentials ...
Please enter the Administrator (root) password.
*standard in must be a tty*

# --- Check for 'Root' credentials
CMDLN_ARGS="$@" # Command line arguments for
this script
# Run this script as root if not already.
# if passed silent option, will exit on failure.
chk_root () {

    if [ ! $( id -u ) -eq 0 ]; then
        if [ "$temp_cond" != "silent" ] ;then
            echo "Please enter the Administrator (root) password."
            exec su -c "${0} ${CMDLN_ARGS}" # Call this prog as root
            exit ${?} # sice we're 'execing'
above, we wont reach this exit
                                            # unless something goes
            # the 'silent' option has been set - just exit.
            echo "root privilages have not been met ."
            exit 1


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Received on 2007-12-11