Pergunta

update.sh

for item in *
do
    if [ -d "$item" ]; then
        echo processing $item
        cd $item
        git pull
        echo finish $item
        printf "\n------------------------------------\n\n"
        cd ..
    fi
done

The function will list current directories and enter each directory to execute git pull, it's work in Windows when use git bash, but show error message update.sh: 2: update.sh: Syntax error: word unexpected (expecting "do") in my Linux Mint 13 Maya, how to fix it?

Foi útil?

Solução

Your file update.sh has CR+LF line endings.

Change the line endings to LF and the script should work well. You can use the utility dos2unix to convert the line endings.

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