The following shell script is used to process files in direc
     The following shell script is used to process files in directory test which is located in current working directory It has following features  Add a prefix \"my\" to all c files in directory test  E.g Rename test G  as my  test.c  Add an extension  \"bak\" to all txt files in directory test  E.g. Rename test txt as test.txt.bak  Compile all java files in directory test Count the number of c files in directory test.  #1/bin/bash  nCfile-0  for dir in  i do  case \"Sdir\" in * c)  *. txt)  eaac  done  echo there are Sncfile C filea in directory test 
  
  Solution
nCfile=0
 for dir in test/* ; do
case \"$dir\" in
 *.c) mv $dir $(printf \'%s\' \"$dir\" | sed \'s,test/,test/my,\')
 nCfile=$((nCfile+1))
 ;;
 *.txt) mv $dir $(printf \'%s\' \"$dir\" | sed \'s,test/,test/my,\')
 ;;
*.java) javac $dir
 ;;
 esac
 done
echo there are $nCfile C files in directory test

