fork download
  1. #!/bin/bash
  2. declare -a arr=("/test/path/test file with spaces.__1"
  3. "/test/path/test file with spaces.ses"
  4. "/test/path/test file with spaces"
  5. "/test/path/test file with spaces.txt")
  6. # true false false true
  7. PATTERN_STR='(/[^/.]+|\.ses)$'
  8. for FILE_NAME in "${arr[@]}"; do
  9. if [[ "$FILE_NAME" =~ $PATTERN_STR ]]; then
  10. Match_Result="false"
  11. else
  12. Match_Result="true"
  13. fi
  14. echo $Match_Result
  15. done;
  16.  
  17.  
Success #stdin #stdout 0s 5588KB
stdin
Standard input is empty
stdout
true
false
false
true