script BASH não funciona no windows

1

Então eu fiz um script bash, que funciona no MAC perfeito, mas no windows mesmo com cygwin e CURL instalados não funciona, aqui estão os erros que estou recebendo

$ ./r.bash

Project name:
imiodrag
': not a valid identifiertheme_name
: No such file or directory
mkdir: cannot create directory '\r': File exists
>>>>>>>>>>Downloading wordpress...

Warning: Failed to create the file latest.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
158   158    0   158    0     0    531      0 --:--:-- --:--:-- --:--:--   531
curl: (23) Failed writing body (0 != 8)
tar (child): latest.tar.gz\r: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
rm: cannot remove 'latest.tar.gz\r': No such file or directory
>>>>>>>>>>Moving files...

mv: cannot stat 'start-project/wp-base/': No such file or directory
: No such file or directorycontent/themes/
: No such file or directoryib/
>>>>>>>>>>Now downloading jquery...

Warning: Failed to create the file jquery-latest.min.js
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1 93436    1  1127    0     0  17888      0  0:00:05 --:--:--  0:00:05 17888
curl: (23) Failed writing body (0 != 1127)
: No such file or directory./
' is not a git command. See 'git --help'.

Did you mean this?
        init
' did not match any files

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'Lili@Lili-PC.(none)')
: No such file or directory./../../

E aqui está o script:

#!/bin/bash
    echo ""
    echo "Project name: "
    read theme_name
    cd "../"
    mkdir "$theme_name"
    cd "$theme_name"
    echo ">>>>>>>>>>Downloading wordpress..."
    echo ""
        curl -O http://wordpress.org/latest.tar.gz
        tar --strip-components=1 -zxf latest.tar.gz
        rm latest.tar.gz
    cd "../"
        echo ">>>>>>>>>>Moving files..."
        echo ""
        mv start-project/wp-base/ "$theme_name/wp-content/themes/$theme_name"
        cd "$theme_name/wp-content/themes/$theme_name"
    cd js/lib/
        echo ">>>>>>>>>>Now downloading jquery..."
        echo ""
      curl -O http://code.jquery.com/jquery-latest.min.js
    cd ../../
        git init
        git add .
        git commit -a -m "First commit"
    cd ../../../../
    rm -rf start-project

Então por que não está funcionando no Windows? Eu estou no windows 7 64bit final

    
por Uffo 05.11.2012 / 20:25

1 resposta

3

O Cygwin requer finais de linha Unix, como já foi observado. Então, ao invés de terminar cada linha com Carriage Return Line Feed (CRLF), você precisa terminar cada linha com apenas um Line Feed (LF) AKA Newline.

Muitos editores de texto permitem converter os finais de linha. O próprio Cygwin pode converter o arquivo usando a ferramenta de linha de comando d2u .

    
por 05.11.2012 / 20:38