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