Skip to main content

Thread: why does this not work


code:
#!/bin/bash    if [ "$(id -u)" != "0" ];     cd /home/cristian #test  else  echo "you must superuser run script" >&2  fi
i have been reading guide, think error or 2 in it.

hope some1 can help.

i found on web instead.

code:
cmdln_args="$@" # command line arguments script  export cmdln_args    # run script root if not already.  chk_root () {      if [ ! $( id -u ) -eq 0 ];      echo "please enter root's password."      exec su -c "${0} ${cmdln_args}" # call prog root      exit ${?}  # sice we're 'execing' above, wont reach exit                 # unless goes wrong.    fi    }    # call function on - or before script's main loop starts.  chk_root
but know why #1 not work, if can tell me.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk why does this not work


Ubuntu

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO