0

I am getting the following error while executing the script in file "handoff":

sh handoff
'andoff: line 5: syntax error near unexpected token `do
'andoff: line 5: `  do

Here is the content of the file:

cat handoff
while [ 1 ]; do
   credencemove
  k=0
  for n in `cat credencemove.txt`
  do
    status[$k]=$n
    k=`expr $k + 1`
  done
  for m in `cat logsequence.lst`
  do
    status[$k]=$m
    k=`expr $k + 1`
  done
   ls -lrt | grep arch_credence_1 | tail -1 | cut -c 68- | tr -d 'ah_.log.gz' | cut -c -5 > credencereceived.txt
  for o in `cat credencereceived.txt`
  do
    status[$k]=$o
    k=`expr $k + 1`
  done
   clear
   tput bold
   echo "         Received Applied Moved"
   echo "         ========================"
   echo " "
   echo " Credence1 -> ${status[6]} \c"
   echo "  ${status[3]} \c"
   echo "  ${status[0]}"
   tput rmso
   echo " "
   echo "Waiting 15 Minuites for applying further logs..."
   echo "Press ctrl + c to exit"
   sleep 900
done
3
  • Complete question is given in the answer. Commented Jun 24, 2016 at 11:14
  • 2
    Why did you put the question in an answer? You should edit your question and add it there. Commented Jun 24, 2016 at 11:37
  • 2
    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. Commented Jun 24, 2016 at 12:37

1 Answer 1

1

You have carriage return characters (\r) in your bash script, as if the script were created on a Windows text editor.

Cleanse your script with dos2unix.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.