Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
snipplets:prargs [2013/03/23 15:43]
ormaaj
snipplets:prargs [2013/03/23 16:25] (current)
ormaaj
Line 17: Line 17:
 It uses the [[commands:​builtin:​printf | printf command]] to generate a list of arguments, even with escape sequences interpreted. This list is shown formatted by the nl(1) utility. It uses the [[commands:​builtin:​printf | printf command]] to generate a list of arguments, even with escape sequences interpreted. This list is shown formatted by the nl(1) utility.
  
-Another alternative with colorized output.+Another alternative with colorized output. If run in Bash, it temporarily disables all debug output for itself, including the test that determines whether to hide debug output. In ksh, tracing would have to be enabled on the function to show debug output, so it works out to being equivalent.
  
 <code bash> <code bash>
Line 23: Line 23:
 # Optionally set OFD to the desired output file descriptor. # Optionally set OFD to the desired output file descriptor.
 function args { function args {
- if [[ ${BASH_VERSION+$-== *x* ]]; then + { BASH_XTRACEFD=3 command eval ${BASH_VERSION+"$(</​dev/​fd/​0)"​}; } <<​-'​EOF' ​3>/​dev/​null 
- { BASH_XTRACEFD=3 command set +x; } 3>/​dev/​null + case $- in *x*) 
- trap 'trap RETURN; set -x' RETURN + set +x 
- fi+ trap 'trap RETURN; set -x' RETURN 
 + esac 
 +EOF
   
  [[ ${OFD-1} == +([0-9]) ]] || return  [[ ${OFD-1} == +([0-9]) ]] || return
  • snipplets/prargs.1364053429.txt
  • Last modified: 2013/03/23 15:43
  • by ormaaj