Unix shell programming question?

Discussion in 'Linux Discussion' started by Sachin V, May 4, 2008.

  1. Sachin V Guest

    Sachin V
    Can anyone solve this quesiton for me?

    Write a script to read three names to match with the existing stored words. If it finds a match it should print ? the match is found?, If not, print ? Please try again?.
  2. Duane K Guest

    Duane K
    You didn't specify which shell...which makes a huge difference


    set -A colors RED GREEN BLUE PURPLE GREEN YELLOW BLACK WHITE

    while :
    do
    echo "Enter a color"
    read c
    $i=0
    while [ ${color[$i]} != "" ]
    do
    if [ ${colors[$i]} -eq $c ]; then
    print "the match is found"
    exit 0
    fi
    (( i=i+1 ))
    done
    echo "Please try again"
    done
Loading...

Share This Page