【求助】麻烦诸位大大帮我看几个shell编程的问题

我刚学,小白一个,问题有点弱,大家别笑话哈

1.How to Convert many consecutive blank spaces to a single blank space ?
2.Count the number of current directory entries instead of contents
3.Write a shell script to print all the simple files' name in a directory and its subdirectories.
ls -R是不是就可以呀??

4.Write a shell script using a file name and a directory name as input arguments. If this file is a text file (with suffix '.txt'), then check whether this file is located in the given directory      and delete it if it exists;   else if the file name is a directory, delete it.


谢谢各位了。。。