#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    6
    Rep Power
    0

    Then' is not matched


    Hi all,

    I'm writing the script which displays the below error while executing it i unable to trace it
    [Error]:Syntax error at line 32 : `then' is not matched[/error]
    Code:
    #!/bin/sh
    clear
    
     while :
      do
       tput cup 7 1  ; echo "Name of the EDP operator: ______________ (Q-Quit)\c"
        tput cup 7 27 ; read aeUserId
    
         case "$aeUserId" in
          "Q"|"q")        return
                           ;;
                            "")             continue
                             ;;
             esac
     ##
     ## Check for valid UNIX user
     ##
      if ! grep "$aeUserId:" /etc/passwd > /dev/null ; then
      tput cup 9 1 ; echo "ERROR: User Id specified does not exist..."
       Pause
                 continue
                          fi
                           break
                            done
     echo PLEASE ENTER THE ENVIRONMENT ITMM or ASIA
    read env
    env="$echo "$env" | tr "[:lower:]" "[:upper:]")"
    if [ "$env" = "ITMM" ] ; then
    echo $PLEASE ENTER THE FUNCTIONAL PREFIX with '*'
    read tk
    find /apps/pahalnger2/storage/data -name "$tk" -exec ls -lrt {} \;
    elif [ "$env" = "ASIA" ] ; then
    echo $PLEASE ENTER THE FUNCTIONAL PREFIX with '*'
    read kt
    find /apps/pahalnger3/storage/data -name "$kt" -exec ls -lrt {} \;
    thanks for the timely help
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,448
    Rep Power
    1751
    Apart from 'nasty' indentation, using Pause instead of pause (unless you have a command called Pause) you do not have a fi to match the last if.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    6
    Rep Power
    0
    Originally Posted by SimonJM
    Apart from 'nasty' indentation, using Pause instead of pause (unless you have a command called Pause) you do not have a fi to match the last if.
    thanks simon it's my nasty mistake thanks for the suggestion
    now it's working
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,448
    Rep Power
    1751
    Glad it's working.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo