File: hello_world_all

package info (click to toggle)
shellia 5.7.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: sh: 7,087; makefile: 34
file content (39 lines) | stat: -rwxr-xr-x 1,319 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/dash
#        file: hello_world2
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
#     license: GNU General Public License, version 3
# description: example "hello world" script with function, debug and check
#     warning: for security, use $(mktmep) instead of /tmp/mylog for ia_logfile
#     warning: Be aware that the interactive step size in this example is only
#              reasonable to summanrized demonstrate shellia features.
#              Read shellia(7) NOTES, to learn about a reasonable size of
#              interactive steps.
#       usage: ./hello_world2 [-d] [-i|-s|-m] [--] <name>

# we prefer a local copy of ia, if it exists
[ -f ia ] && . ./ia || . /usr/share/shellia/ia

# say_hello <name>
say_hello()
{
  local name

  { set +x; } 2>/dev/null
  eval "$ia_init"
  ia_add "dbg \"function say_hello called with $# arguments\""
  ia_add "[ $# -eq 1 ] || return 42 # check arguments"
  ia_add "name=\"$1\""
  ia_stdout ".*"
  ia_add "echo \"hello \$name\""
  ia_add "dbg \"function say_hello end\""
  ia -c -x
}

eval "$ia_init"
ia_add "dbg \"main program begin\""
ia_add "[ \"$1\" ] || { ia_err \"Need one name to greet!!!\"; exit 1; }"
ia_stdout "^hello"
ia_add "say_hello <-i> -- $*"
ia_stdout "^please remove Logfile"
ia_add "dbg \"main program end\""
ia -c -x