summaryrefslogtreecommitdiffstats
path: root/test/bashisms/functions.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:39:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:39:23 +0000
commite3b16b3856bdd5c1645f4609d61bf5a16c026930 (patch)
treed9def3b6f6f46b166fc6f516775350fedeefbef6 /test/bashisms/functions.sh
parentInitial commit. (diff)
downloaddevscripts-upstream.tar.xz
devscripts-upstream.zip
Adding upstream version 2.19.5+deb10u1.upstream/2.19.5+deb10u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--test/bashisms/functions.sh66
-rw-r--r--test/bashisms/functions.sh.out32
2 files changed, 98 insertions, 0 deletions
diff --git a/test/bashisms/functions.sh b/test/bashisms/functions.sh
new file mode 100644
index 0000000..18adf3d
--- /dev/null
+++ b/test/bashisms/functions.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+foo() {
+ :
+}
+
+_all_good () {
+ :
+}
+
+_all_good101_ ( ) {
+ :
+}
+
+function BASHISM() {
+ :
+}
+
+function BASHISM {
+ :
+}
+
+function BASHISM {
+ echo foo
+} &>/dev/null # BASHISM
+
+,() { # BASHISM
+ :
+}
+
+function foo:bar:BASHISM { # BASHISMS
+ :
+}
+
+function foo-bar-BASHISM() { # BASHISMS
+ :
+}
+
+foo-bar-BASHISM ( ) {
+ :
+}
+
+_ () {
+ :
+}
+
+function _ { #BASHISM
+ :
+}
+
+=() { #BASHISM
+ :
+}
+
+function BASHISM=() { #BASHISMS
+ :
+}
+
+function BASHISM= { #BASHISMS
+ :
+}
+
+# This doesn't work:
+#foo=() {
+# :
+#}
diff --git a/test/bashisms/functions.sh.out b/test/bashisms/functions.sh.out
new file mode 100644
index 0000000..61a4c4d
--- /dev/null
+++ b/test/bashisms/functions.sh.out
@@ -0,0 +1,32 @@
+possible bashism in bashisms/functions.sh line 15 ('function' is useless):
+function BASHISM() {
+possible bashism in bashisms/functions.sh line 19 ('function' is useless):
+function BASHISM {
+possible bashism in bashisms/functions.sh line 23 ('function' is useless):
+function BASHISM {
+possible bashism in bashisms/functions.sh line 25 (should be >word 2>&1):
+} &>/dev/null # BASHISM
+possible bashism in bashisms/functions.sh line 27 (function names should only contain [a-z0-9_]):
+,() { # BASHISM
+possible bashism in bashisms/functions.sh line 31 (function names should only contain [a-z0-9_]):
+function foo:bar:BASHISM { # BASHISMS
+possible bashism in bashisms/functions.sh line 31 ('function' is useless):
+function foo:bar:BASHISM { # BASHISMS
+possible bashism in bashisms/functions.sh line 35 (function names should only contain [a-z0-9_]):
+function foo-bar-BASHISM() { # BASHISMS
+possible bashism in bashisms/functions.sh line 35 ('function' is useless):
+function foo-bar-BASHISM() { # BASHISMS
+possible bashism in bashisms/functions.sh line 39 (function names should only contain [a-z0-9_]):
+foo-bar-BASHISM ( ) {
+possible bashism in bashisms/functions.sh line 47 ('function' is useless):
+function _ { #BASHISM
+possible bashism in bashisms/functions.sh line 51 (function names should only contain [a-z0-9_]):
+=() { #BASHISM
+possible bashism in bashisms/functions.sh line 55 (function names should only contain [a-z0-9_]):
+function BASHISM=() { #BASHISMS
+possible bashism in bashisms/functions.sh line 55 ('function' is useless):
+function BASHISM=() { #BASHISMS
+possible bashism in bashisms/functions.sh line 59 (function names should only contain [a-z0-9_]):
+function BASHISM= { #BASHISMS
+possible bashism in bashisms/functions.sh line 59 ('function' is useless):
+function BASHISM= { #BASHISMS