# Checking number of command line args
case $# in
0) echo "You forgot to supply the argument" ;;
1) ... process the argument ... ;;
*) echo "You supplied too many arguments" ;;
esac
# Classifying a file via its name
case "$file" in
*.c) echo "$file looks like a C source-code file" ;;
*.h) echo "$file looks like a C header file" ;;
*.o) echo "$file looks like a an object file" ;;
...
?) echo "$file's name is too short to classify it" ;;
*) echo "I have no idea what $file is" ;;
esac
|