Skip to content
Snippets Groups Projects
Commit 3e961454 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

refactor: use variable for group options

parent 7fcdbf37
1 merge request!154Add script to move between groups
#!/bin/bash
group_options=(gpfs4 gpfs5)
user=$1
group_to=$2
if [[ -z "${group_to}" ]]; then
echo "Usage: $0 USER TARGET_GROUP"
exit 1
elif [[ "${group_to}" != "gpfs4" && "${group_to}" != "gpfs5" ]]; then
echo "Target group should be \"gpfs4\" or \"gpfs5\", got \"${group_to}\"."
elif [[ ! " ${group_options[*]} " =~ [[:space:]]${group_to}[[:space:]] ]]; then
echo "Invalid target group"
echo "Available options: ${group_options[*]}, got ${group_to}"
exit 1
fi
......@@ -21,7 +24,6 @@ fi
cd /cm/shared/rabbitmq_agents || exit
source venv/bin/activate
if [[ "$group_to" == "gpfs4" ]]; then
group_from=gpfs5
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment