20230322
[shlib.git] / doc / example / gplib / func-return-string
blobed77476d5420638fa084e497a716ddd68d7755ab
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 #     define function with named paramter, and return with
15 # string value from function.
16 ############################################################
19 # todoļ¼š
20 # @ 
21 # @ 
24 . shlibinc
27 ##############################
28 # section: shlib include
29 ##############################
31 include gplib.shlib
32 include stdio.shlib
35 ##############################
36 # section: public comment info
37 ##############################
42 ##############################
43 # section: variable define
44 ##############################
49 ##############################
50 # section: private function
51 ##############################
53 func abc [ int a, int b, c ]
55         local ret="this string is return from function abc()."
56         echo aaa
57         {
58                 echo param a = $a
59                 echo param b = $b
60                 echo param c = $c
61         }
62         dreturn $ret
66 ##############################
67 # section: public function
68 ##############################
71 # main <eval-str>
73 main ()
75         echo "func-paramter:"
76         
77         echo xxxxxxxxxxxxxxxxxxxxxxxxx
78         type abc
79 #       alias
80         
81         echo xxxxxxxxxxxxxxxxxxxxxxxxx
82         echo execute abc\(\)
83         abc 1 2 3
84         get_ret_str
85         
86         echo invoke abc[1,2,3]
87         invoke abc [1,2,3]
88         get_ret_str
92 main "$@"
94 ##############################
95 # section: file tail
96 ##############################