Posted By

wolfie on 05/06/08


Tagged

wrapper Bash batch


Versions (?)

Create a batch file wrapper for a script in linux


 / Published in: Bash
 

Useful if you need to run the same command for lots and lots of different parameters

  1. #!/bin/bash
  2.  
  3. cwd=`pwd`
  4. cmd="$cwd/one_user.pl"
  5. params="$cwd/param_file.txt"
  6.  
  7. for line in `cat $params`
  8. do
  9. ## for deployment uncomment the next line
  10. #echo `$cmd $line > logs/$line.txt 2>&1`
  11.  
  12. ## for testing purposes, makes sure that you're getting what you expect
  13. echo $cmd $line
  14.  
  15. done
  16.  
  17. echo
  18. exit 0

Report this snippet  

You need to login to post a comment.