Question : Bash Script

#!/bin/bash
for server in xxxx
do
if["${server:8:1}"=="b"] then
        DEPLOYS="WASDeploy CLPDeploy"
        SUFFIX="DR"
else
        DEPLOYS="DBDeploy WASDeploy CLPDeploy"
        SUFFIX=
fi
done
Giving me the following syntax error. What should I do?
./27.5.65.sh: line 13: syntax error near unexpected token `else'
./27.5.65.sh: line 13: `else'

$ uname -a
Linux xldn0323bap 2.6.18-128.1.6.el5 #1 SMP Tue Mar 24 12:05:57 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

Answer : Bash Script

Not only will proper indenting make the script more readable, it will also fix your error as your if/then/else block will be correct.
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:
28:
29:
30:
#!/bin/bash

VERSION=27.5.65 
for server in xldn0323bap xldn0322pap 
do 
  echo "Server: $server" 
  echo "Deleting old data... from /sbclocal/apps/ske/SKERelease-Temp/" 
  ssh $server 'rm -rf /sbclocal/apps/ske/SKERelease-Temp/*' 
  echo "Copying build..." 
  scp xldn1515vdap:/sbclocal/etdet/teamcity/published-builds/${VERSION}/Build/tars/SKE_Installer-${VERSION}.tar $server:/sbclocal/apps/ske/SKERelease-Temp/ 

  if [ "${server:8:1}" = "b" ]
  then 
     DEPLOYS="WASDeploy CLPDeploy" 
     SUFFIX="DR" 
  else 
     DEPLOYS="DBDeploy WASDeploy CLPDeploy" 
     unset SUFFIX
  fi

  for deploy in $DEPLOYS 
  do 
    echo "Untaring ${deploy}..." 
    DIRNAME="/sbclocal/apps/ske/SKERelease-Temp/${deploy}${SUFFIX}" 
    echo "Making DIRNAME $DIRNAME"
    ssh $server mkdir $DIRNAME
    ssh $server tar -xvf /sbclocal/apps/ske/SKERelease-Temp/SKE_Installer-${VERSION}.tar -C $DIRNAME 
    done 

done
Random Solutions  
 
programming4us programming4us