Create a batch file wrapper for a script in linux


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.