Home | History | Annotate | Line # | Download | only in Examples
      1  1.1  christos The following are examples of sh_lines.d.
      2  1.1  christos 
      3  1.1  christos This is a simple script to count Bourne shell line execution. Here it traces an
      4  1.1  christos example program, Code/Shell/func_slow.sh.
      5  1.1  christos 
      6  1.1  christos    # sh_lines.d 
      7  1.1  christos    Tracing... Hit Ctrl-C to end.
      8  1.1  christos    ^C
      9  1.1  christos    
     10  1.1  christos                                 FILE:LINE        COUNT
     11  1.1  christos                         func_slow.sh:5               1
     12  1.1  christos                         func_slow.sh:6               1
     13  1.1  christos                         func_slow.sh:15              1
     14  1.1  christos                         func_slow.sh:16              1
     15  1.1  christos                         func_slow.sh:21              1
     16  1.1  christos                         func_slow.sh:26              1
     17  1.1  christos                         func_slow.sh:27              1
     18  1.1  christos                         func_slow.sh:32              1
     19  1.1  christos                         func_slow.sh:35              1
     20  1.1  christos                         func_slow.sh:30            100
     21  1.1  christos                         func_slow.sh:28            101
     22  1.1  christos                         func_slow.sh:19            200
     23  1.1  christos                         func_slow.sh:17            201
     24  1.1  christos                         func_slow.sh:9             300
     25  1.1  christos                         func_slow.sh:7             301
     26  1.1  christos                         func_slow.sh:1             600
     27  1.1  christos 
     28  1.1  christos The most frequently executed line was line 1 of func_slow.sh - which is actually
     29  1.1  christos line 1 of func_slow.sh subshells (command substitution, ` `). Apart from
     30  1.1  christos this slight confusion, the rest of the output should make sense (and most
     31  1.1  christos scripts only call one line in command substitution anyway).
     32  1.1  christos 
     33