From 8419a1abc8e469353a480420af3fc061130bee75 Mon Sep 17 00:00:00 2001 From: Veaceslav Medvedev Date: Tue, 5 Mar 2019 19:11:23 +0100 Subject: [PATCH] Fix running command --- files-watcher/files-watcher | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/files-watcher/files-watcher b/files-watcher/files-watcher index 0de503d..a557ebd 100755 --- a/files-watcher/files-watcher +++ b/files-watcher/files-watcher @@ -90,6 +90,13 @@ report_done() { [[ $# > 0 ]] && echo "${FCG}✓ $@${NC}" || echo "${FCG}✓ Done${NC}" } +run_command() { + local previous_ifs=${IFS} + IFS=' ' + command $@ + IFS=${previous_ifs} +} + main() { watch_branches=$(git config --default master --get files-watcher.watch-branches) default_mode=$(git config --default prompt --get files-watcher.mode) @@ -141,16 +148,16 @@ main() { for command in ${commands} ; do case "${mode}" in "auto" ) - command ${command} + run_command "${command}" ;; "prompt" ) if prompt "Do you like to run '${command}'?"; then - command ${command} + run_command "${command}" fi ;; "confirm" ) if confirm "Do you like to run '${command}'?"; then - command ${command} + run_command "${command}" fi ;; * )