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. Similar Threads: Unix shell
    Forum Title Date
    Linux Discussion A unix shell script has to check for a file in a folder, once every 5 mins? May 10, 2008
    Linux Discussion How do I check if my linux, or unix, box is 32bit of 64bit through the terminal? Jul 3, 2008
    Linux Discussion How do I run multiple commands on a Unix/Linux system without a GUI? Jul 3, 2008
    Linux Discussion unix help!!!!!? Jun 18, 2008
    Linux Discussion Unix/programming question? Jun 18, 2008
    Linux Discussion free UNIX servers? Jun 3, 2008
    Linux Discussion Installing Unix with Windows XP? Jun 1, 2008
    Linux Discussion Drivers for Unix? May 30, 2008
    Linux Discussion What is recursive in Linux/Unix? May 30, 2008
    Linux Discussion Can we perform mathematical operations on UNIX dates? May 30, 2008

  3. 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

Share This Page