Skip to content

Instantly share code, notes, and snippets.

@dky
Created February 24, 2025 19:22
Show Gist options
  • Save dky/3fff2858642f2ea34924f105245af4da to your computer and use it in GitHub Desktop.
Save dky/3fff2858642f2ea34924f105245af4da to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define functions
function func1() {
echo "Executing Function 1..."
# Add your commands for func1 here
}
function func2() {
echo "Executing Function 2..."
# Add your commands for func2 here
}
function func3() {
echo "Executing Function 3..."
# Add your commands for func3 here
}
# Display usage information if no argument is provided
if [ "$#" -eq 0 ]; then
echo "Usage: $0 {func1|func2|func3}"
exit 1
fi
# Choose the function to run based on the first argument
case $1 in
func1)
func1
;;
func2)
func2
;;
func3)
func3
;;
*)
echo "Invalid argument: $1"
echo "Usage: $0 {func1|func2|func3}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment