code repo connnect test
[shlib.git] / doc / example / stdio-dbgout / subscript-variable-modify
blob97c52c69b90c14e95e3d485d71bd13d0c4e241d7
2 #!/bin/bash
3 ############################################################
4 # source: shlib
5 # author: devenkong(18151155@qq.com)
6 # date: 2022-07-29
7 ############################################################
8 # Copyright (C) 2022- Free Software Foundation, Inc.
9 # This configure script is free software; the Free Software 
10 # Foundation gives unlimited permission to copy, distribute 
11 # and modify it.
12 ############################################################
13 # note:
14 #     variable modification in some of while loop is not
15 # effective.
16 ############################################################
19 # todoļ¼š
20 # @ 
21 # @ 
25 . shlibinc
28 ##############################
29 # section: shlib include
30 ##############################
32 include gplib.shlib
33 include stdio.shlib
36 ##############################
37 # section: public comment info
38 ##############################
43 ##############################
44 # section: variable define
45 ##############################
50 ##############################
51 # section: private function
52 ##############################
57 ##############################
58 # section: public function
59 ##############################
62 # main <eval-str>
64 main ()
66         local testvar=aaa
67         local cnt=0
68         echo "func-paramter:"
69         
70         init_dbglogout 2 shlibopt 20000
71         
72         info "this example shows how to use debug infomation output function in sub-process of while loop."
73         echo xxxxxxxxxxxxxxxxxxxxxxxxx
74         
75         echo testvar=$testvat
76         cat data.txt | 
77         while read line; do
78             : $(( cnt++ ))
79                 info cnt=$cnt
80                 [[ $cnt = 5 ]] && break
81                 
82                 info testvar=$testvat
83                 echo $line
84                 dbgout "output debug string here."
85                 info "output info string on tty console."
86         done > output.txt
87         
88         echo at last, cnt=$cnt
89         echo output.txt is:
90         cat output.txt
91         
92         echo xxxxxxxxxxxxxxxxxxxxxxxxx
96 main "$@"
98 ##############################
99 # section: file tail
100 ##############################