runtime(sh): better function support for bash/zsh in indent script
closes: #16052
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/indent/testdir/bash.in b/runtime/indent/testdir/bash.in
new file mode 100644
index 0000000..7ffcfc7
--- /dev/null
+++ b/runtime/indent/testdir/bash.in
@@ -0,0 +1,22 @@
+#!/bin/bash
+# vim: set ft=bash sw=2 noet:
+
+# START_INDENT
+a = 10
+b = 20
+
+function add() {
+c = $((a + b))
+}
+
+function print {
+# do nothing
+}
+
+if [[ $c -ge 15 ]];
+then
+print("ok")
+else
+print("not ok")
+fi
+# END_INDENT
diff --git a/runtime/indent/testdir/bash.ok b/runtime/indent/testdir/bash.ok
new file mode 100644
index 0000000..93d5b33
--- /dev/null
+++ b/runtime/indent/testdir/bash.ok
@@ -0,0 +1,22 @@
+#!/bin/bash
+# vim: set ft=bash sw=2 noet:
+
+# START_INDENT
+a = 10
+b = 20
+
+function add() {
+ c = $((a + b))
+}
+
+function print {
+ # do nothing
+}
+
+if [[ $c -ge 15 ]];
+then
+ print("ok")
+else
+ print("not ok")
+fi
+# END_INDENT