yes, you used ls -1
(one) instead of ls -l
(lower case L).
Actually if your intention is to get a directory from the user, and print the list of files in each of its subdirectories, will this code help?
read -p "give directory's name: " NAME
DIRLIST=`find $NAME -type d -maxdepth 1`
echo "dirlist is $DIRLIST"
for dir in $DIRLIST
if [ "$NAME" != "$dir" ]
echo "Here are the files in $dir"
ls -1 $dir
The only difference is that the user doesn't have to prompt each subdirectory's name in this case.