Guest User

Untitled

a guest
May 22nd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. ./my_program --option1 --option2 --option3
  2.  
  3. use_option3=1 # or 0
  4.  
  5. option3=""
  6. if [ $use_option3 == 1 ]; then
  7. option3="--option3"
  8. fi
  9.  
  10. ./my_program --option1 --option2 "$option3"
  11.  
  12. opts=(--option1 --option2)
  13.  
  14. if [[ $use_option3 == 1 ]]; then
  15. opts+=(--option3)
  16. fi
  17.  
  18. ./my_program "${opts[@]}"
Add Comment
Please, Sign In to add comment