summaryrefslogtreecommitdiff
path: root/samples/test.sh
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 20:22:09 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 20:22:09 +0100
commit5a8dbc6347b3541e84fe669b22c17ad3b715e258 (patch)
treeb148c450939688caaaeb4adac6f2faa1eaffe649 /samples/test.sh
downloadqwe-editor-5a8dbc6347b3541e84fe669b22c17ad3b715e258.tar.gz
Engage!
Diffstat (limited to 'samples/test.sh')
-rw-r--r--samples/test.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/samples/test.sh b/samples/test.sh
new file mode 100644
index 0000000..5696456
--- /dev/null
+++ b/samples/test.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# A simple bash script demo
+
+APP_NAME="MyShellApp"
+VERSION="1.0.0"
+
+echo "Starting $APP_NAME version $VERSION..."
+
+# Check if a directory exists
+if [ -d "/tmp" ]; then
+ echo "/tmp directory exists."
+else
+ echo "/tmp directory does not exist, creating it..."
+ mkdir /tmp
+fi
+
+# Loop through arguments
+echo "Arguments provided:"
+for arg in "$@"; do
+ echo "- $arg"
+done
+
+# Function definition
+greet() {
+ local name=$1
+ echo "Hello, $name!"
+}
+
+# Call function
+greet "User"
+
+# While loop
+count=0
+while [ $count -lt 5 ]; do
+ echo "Count: $count"
+ ((count++))
+done
+
+# Case statement
+case "$1" in
+ start)
+ echo "Starting service..."
+ ;;
+ stop)
+ echo "Stopping service..."
+ ;;
+ restart)
+ echo "Restarting service..."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+
+echo "Done."