-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrr
More file actions
executable file
·28 lines (24 loc) · 712 Bytes
/
Copy pathrr
File metadata and controls
executable file
·28 lines (24 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
show_help() {
echo "Usage: rr <script_name> [args]"
echo "Execute a script from the scripts directory."
echo "Available scripts:"
echo "------------------"
echo
for script in $(ls ./scripts/*.bash); do
# print script name without the .bash extension
echo "rr $(basename $script .bash)"
sed -n '2,/^$/p' "$script" | sed 's/^#//'
done
}
# Combine the parameter with the .bash extension
script_name="./scripts/$1.bash"
shift
# Check if the script exists
if [ -f "$script_name" ]; then
# Execute the script with the remaining arguments
(cd $(pwd) && bash "$script_name" "$@")
else
echo "Script not found: $script_name"
show_help
fi