Pergunta

Good evening everybody, We're looking forward to execute a shell script on an Ubuntu 8.04, But it returns a special error:

line 14: Word unexpected (expecting "in")

So here is a preview of the script:

#!/bin/sh
#Declaration of shell parameters
A3REP=""
A3FILE=""
A3HELP=""
A3PORT="80"
A3PORTTC="80"
A3IP400=""
A3USER=""
A3PWD=""
A3TASK=""
while getopts d:f:h:p:i:u:w:t:n: option
do 
  case $option in
    d)
    A3REP="$OPTARG"
    ;;
    f)  
    A3FILE="$OPTARG"
        ;;
    p)  
    A3PORT="$OPTARG"
        ;;
    t)  
    A3PORTTC="$OPTARG"
        ;;
    i)  
    A3IP400="$OPTARG"
        ;;
    u)  
    A3USER="$OPTARG"
        ;;
    w)  
    A3PWD="$OPTARG"
        ;;
    n)  
    A3TASK="$OPTARG"
        ;;
    h)
    A3HELP="aide"
    ;;
  esac
done

PROBLEM SOLVED: the script was in dos:

insert the following line in d2u.sh:

#!/bin/bash
cat $1|tr -d '\015'

and now execute :

chmod +x d2u.sh

now the script is ready to run.

Try this script typing the following command:

sh d2u.sh filename.sh > filename2.sh

and the script isn't in dos anymore.

Thank you everybody! :)

Foi útil?

Solução

Perhaps a problem with line endings, try

d2u FILE

ref

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top