Skip to main content
added 2 characters in body
Source Link
muru
  • 78.3k
  • 16
  • 214
  • 320

There are various ways of doing this. Personally, I find functions clearer:

run_this(){ TZ=GMT LC_ALL=C LONG_ENV_VAR=foo $@"$@" } if [[ some_thing ]]; then run_this my_command elif [[ some_other_thing ]]; then run_this my_command --with-arg else run_this my_command --with-other-arg fi 

There are various ways of doing this. Personally, I find functions clearer:

run_this(){ TZ=GMT LC_ALL=C LONG_ENV_VAR=foo $@ } if [[ some_thing ]]; then run_this my_command elif [[ some_other_thing ]]; then run_this my_command --with-arg else run_this my_command --with-other-arg fi 

There are various ways of doing this. Personally, I find functions clearer:

run_this(){ TZ=GMT LC_ALL=C LONG_ENV_VAR=foo "$@" } if [[ some_thing ]]; then run_this my_command elif [[ some_other_thing ]]; then run_this my_command --with-arg else run_this my_command --with-other-arg fi 
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719

There are various ways of doing this. Personally, I find functions clearer:

run_this(){ TZ=GMT LC_ALL=C LONG_ENV_VAR=foo $@ } if [[ some_thing ]]; then run_this my_command elif [[ some_other_thing ]]; then run_this my_command --with-arg else run_this my_command --with-other-arg fi