Last active
          May 26, 2018 07:50 
        
      - 
      
- 
        Save obatiuk/54504c28d365b1766467ca00ad446af0 to your computer and use it in GitHub Desktop. 
    Simple line to enable debug in shell if '-debug' argument is specified
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # version #1: enables xtrace if `--debug` argument is supplied | |
| [ -n "$(echo $@ | grep "\--debug")" ] && set -x | |
| # version #2: sets debug variable to 'true' if `--debug` argument is supplied or `xtrace` option is set | |
| debug=false && [ -n "$(echo $@ | grep "\--debug")" ] || [ -n "$(set | grep xtrace)" ] && debug=true | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment