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

    Error Message Help


    I keep getting this error message when i try to run one of my script

    test4: line 9: syntax error near unexpected token `)'
    test4: line 9: ` *) echo $k ;; '

    I have been trying for hours to fix this but nothing seems to work. What can i do to fix this??

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Can you paste your script?

  3. #3
    Yeah sure

    ##test4
    for k in `echo $*`
    do
    case $k in
    [1-9]*) echo $k | tr [1-9][0-8] ;;
    [a-f]*) echo $k | tr [a-e][U-Y] ;;
    [U-Z]*) echo $k | tr [U-Z][L-Q] ;;
    [i-k]*) echo "Hey"
    *) echo $k ;;
    esac
    done


    (THIS IS NOT HW)

  4. $spacer_open
    $spacer_close
  5. #4
    You forgot to put ;; in the Hey line.

  6. #5
    Thanks for help..I typed the ;; after hey and got this message

    tr: two strings must be given when translating unused

    not sure if this is an error message or not but oh well

    Thanks for the help guys

  7. #6
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    You should be putting spaces between the [foo-bar][baz-blech] commands in 'tr'.
    so, for example, instead of:
    Code:
     [U-Z]*) echo $k | tr [U-Z][L-Q] ;;
    do
    Code:
     [U-Z]*) echo $k | tr [U-Z] [L-Q] ;;

Posting Permissions

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