help with cut command

i am making this program that lists files in the current directory, it asks the user to input the file they want to list, eg "list " then they have to input the name of the file they want to list "unix.txt".. the input has to have the word list in it...

i wrote the script this way..

#!/bin/sh
echo -n "Enter a command: "
read choice

if [ "$choice" == "list" ]
then
         echo -n "Enter the name of the file you want to list"
         read choice2

         ls "$choice2"
else
        echo "Invalid command"
fi

can someone help me use the cut command to list the file user wants, in one input (ie "list unix.txt"), instead of asking for two inputs? (the program is in bourne shell)

thanks in advance

ls | grep "$choice"

or

ls *list*

add these lines..

thanks for the reply... i am new to shell scripting, can you please explain wwhat you did?

thanks

echo Please Enter COMMAND and FILE:
read choice choice2
if [ "$choice" = "list" ]
then
    ls $choice2
fi

---------- Post updated at 05:35 AM ---------- Previous update was at 05:32 AM ----------

Next you want to add more possible commands, you do it like this:

case $choice in
   list) ls $choice2;;
   delete) rm $choice2;;
esac

Otherwise, you can just do the shorthand:

[ "$choice" = "list" ] && ls $choice2

The above line reads: If the part between the [...] brackets evaluates to true (returns zero) then execute the part after the &&

hartz, thanks so much!!