Advertisement
Guest User

test script

a guest
Jul 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/bin/bash
  2. function readFile {
  3. while IFS='' read -r line || [[ -n "$line" ]]; do
  4. if [ notComment $line eq 1 ]; then
  5. echo "Going to execute command: select 1 to execute, 2 to skip, 0 to stop"
  6. echo "$line"
  7. read input
  8. if [ input -eq 1 ]; then
  9. eval $line
  10. else if [ input -eq 2 ]; then
  11. continue
  12. else break
  13. fi
  14. fi
  15. done < "$1"
  16. }
  17.  
  18. function notComment {
  19. local str = "$1"
  20. if [ $str =~ ^# || $str =~ ^( *)# ] then
  21. return 0
  22. else return 1
  23. fi
  24. }
  25.  
  26. echo 'Enter the file path to run'
  27. read fileName
  28. echo 'file path' + $fileName
  29. readFile $fileName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement