How can I use this sh script with for loop and an "array".
I would like to call the domains with a for loop
inside the if
.
Example:
for domain in $DOMAINS
do
printf '%s\n' "$domain"
done
So if you add that under if then the printf
should be like what?
For example, the wlstop
I would like to be called where the printf
is with wls wlstop $domain
.
#!/usr/bin/sh
ENV=$1
DOMAINS="1 2 3"
wls (){
echo "$0 : $1 -v -d $2"
$1 -v -d $2
}
remove (){
echo "$0 : Removing /domains/$1/servers/*"
set -x
rm -rf /domains/$1/servers/*
set +x
}
echo "$0 : Running wlsfullclean for $ENV"
if [ "$ENV" = "Utv" ]; then
#Stop domain
wls wlsstop 1
wls wlsstop 2
wls wlsstop 3
#Remove content in servers folder
remove 1
remove 2
remove 3
#wlsclean
wls wlsclean 1
wls wlsclean 2
wls wlsclean 3
#wlscfi
wls wlscfi 1
wls wlscfi 2
wls wlscfi 3
#Start server
wls wlsstart 1
wls wlsstart 2
wls wlsstart 3
elif [ "$ENVI" = "Prod" ]; then
echo "Prod"
fi