Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function readFile {
- while IFS='' read -r line || [[ -n "$line" ]]; do
- if [ notComment $line eq 1 ]; then
- echo "Going to execute command: select 1 to execute, 2 to skip, 0 to stop"
- echo "$line"
- read input
- if [ input -eq 1 ]; then
- eval $line
- else if [ input -eq 2 ]; then
- continue
- else break
- fi
- fi
- done < "$1"
- }
- function notComment {
- local str = "$1"
- if [ $str =~ ^# || $str =~ ^( *)# ] then
- return 0
- else return 1
- fi
- }
- echo 'Enter the file path to run'
- read fileName
- echo 'file path' + $fileName
- readFile $fileName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement