Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I made a bash script, that works on MAC perfect, but on windows even with cygwin and CURL installed doesn't work, here is the errors that I'm getting

$ ./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 "you@example.com"
  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./../../

And here is the 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

So why isn#t working on windows?any advices? I'm on windows 7 64bit ultimate

share|improve this question
4  
Try using Unix line endings. –  Daniel Beck Nov 5 '12 at 19:29
    
can you be more specific please? thank you –  Uffo Nov 5 '12 at 19:31
2  
Use a text editor (e.g. Notepad++) and save your bash script with Unix line endings. I don't know how to be more specific. –  Daniel Beck Nov 5 '12 at 19:35
add comment

1 Answer

up vote 3 down vote accepted

Cygwin requires Unix line endings, as has already been noted. So instead of ending each line with Carriage Return Line Feed (CRLF), you need to end each line with just a Line Feed (LF) AKA Newline.

Many text editors allow you to convert the line endings. Cygwin itself can convert the file using the command line tool d2u.

share|improve this answer
1  
Thanks d2u did the job, I will accept in 5 min –  Uffo Nov 5 '12 at 19:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.