SHARE
TWEET

Testing Shell Script :|

Mayur_Pipaliya Feb 22nd, 2012 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #Command to view list of files..
  4. var_list=`ls -lrt /path/infy/ |grep "$cdate"| awk '{print $9}'`
  5.  
  6. #Command to store file list in array..
  7. array_of_file=($var_list)
  8.  
  9.  
  10. if [[ `echo ${array_of_file[*]}` == "" ]]; then
  11.          print "files not received"
  12. else
  13.  for i in `echo ${array_of_file[*]}`; do
  14.         print "files received. .. and extra procesing"
  15. done
  16. fi
  17.  
  18.  
  19. # To Sort array...
  20. unique_array=$(echo $array_of_file | sort -u)
  21. for a in ${unique_array[@]}; do
  22.     echo $a
  23. done
  24.  
  25.  
  26.  
  27. #ps: powerful linux commands and pipeline will work ;)
  28. #ref: http://ubuntuforums.org/showthread.php?t=969177
  29. #ref: http://www.java-samples.com/showtutorial.php?tutorialid=1374
RAW Paste Data
Top