Files
app-template/app.sh
2025-09-29 17:56:05 +08:00

23 lines
549 B
Bash
Executable File

#!/bin/bash
# 环境变量
APP_DIR=$(cd "$(dirname "$0")" && pwd)
# 执行命令
if [ -f "$APP_DIR/cmds/app-$1.sh" ]; then
. "$APP_DIR/cmds/app-$1.sh"
else
echo "Error: usage: ./app.sh <command>"
echo "commands:"
if [ -d "$APP_DIR/cmds" ]; then
for file in "$APP_DIR"/cmds/app-*.sh; do
if [ -f "$file" ]; then
filename=$(basename "$file")
cmd_name=${filename#app-}
cmd_name=${cmd_name%.sh}
echo " $cmd_name"
fi
done
fi
fi