Find the answer to your Linux question:
Results 1 to 4 of 4
I have returned the below mentioned lines of code however Iam recieving error "Syntax Error On Done Statement".Please check and let me know ASP.Thank while : do clear echo "-------------------------------------------------------------------" ...
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    1

    Error on dowhile loop error

    I have returned the below mentioned lines of code however Iam recieving error "Syntax Error On Done Statement".Please check and let me know ASP.Thank
    while :

    do

    clear

    echo "-------------------------------------------------------------------"

    echo "Main Menu"

    echo "-------------------------------------------------------------------"

    echo "[1] Today's Date"

    echo "[2] Show files in the current Directory"

    read yourch

    case $yourch in

    1) echo "Today is `date`,press a key ........";read;;

    2) echo ls -l;read;;

    *) echo "Select the yourch as 1 or 2";

    esca


    Thanks,
    RV
    done

  2. #2
    Just Joined! barriehie's Avatar
    Join Date
    Apr 2008
    Posts
    81
    Code:
    esca should be esac
    Should also enclose your code in code tags. It makes it easier to interpret.

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Posts
    9

    new code

    Code:
    while :
    
    do
    
    clear
    
    echo "-------------------------------------------------------------------"
    
    echo "Main Menu"
    
    echo "-------------------------------------------------------------------"
    
    echo "[1] Today's Date"
    
    echo "[2] Show files in the current Directory"
    
    read yourch
    
    case $yourch in
    
    1) echo "Today is `date`,press a key ........";read;;
    
    2) ls -l;read;;
    
    *) echo "Select the yourch as 1 or 2";
    
    esac
    
    done

    This is what you want to do. I changed esca to esac, removed thanks, RV and removed echo in case 2.

  4. #4
    Just Joined!
    Join Date
    Dec 2006
    Posts
    3

    ; done

    add
    ;
    done
    at end

    *) echo "Select the yourch as 1 or 2";;
    esac
    done

    last 3 line looks like above

Posting Permissions

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