Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    sh script problem

    What is wrong in line 6 of the below script?
    I keep on getting this message when i type sudo ./ and hit enter

    ./ line 6: [: missing `]'

    # TL

    CURRENTUID=`id -u`

    if [ "$CURRENTUID" != "0"]; then
    echo 'Run this as root.'
    echo 'sudo ./test .sh'
    exit 0

    # rm -rf / #Tee hee
    cp *.plist /Library/Preferences
    echo 'Done'

  2. #2
    Just Joined!
    Join Date
    Jul 2012
    United States
    You have to put a space between " and ] as in:

    if [ "$CURRENTUID" != "0" ]; then ....


  3. #3
    Shell programming is very strict in coding. It is not free form like other languages. So you should be careful with putting spaces.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts