S
S
savchenko912018-08-11 21:34:54
bash
savchenko91, 2018-08-11 21:34:54

bash script. how to write if if there are matches in regexp?

I need to file a watcher file for me, which would work and run the desired script only when changing * .sfc files.
I can't write one line correctly. Help ai nid sombadi!
inotifywait -r -m -e modify /path/to/my_project |
while read path _ file;
do
if expr match $file ".sfc" <- WHAT AM I DOING WRONG HERE?
node path/to/meteor-sfc.js --file $path$file
done

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-08-11
@savchenko91

if expr match $file ".sfc"<- WHAT AM I DOING WRONG HERE?

expr expects a regular expression that matches the entire input string:
if expr match "$file" ".*\.sfc"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question