This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bash shell script issue


I am relatively new to shell scripts, but this works on linux and I do not know why it does not work for me in cygwin.

I am running cygwin 32 on a 64-bit Windows 7 computer and so I do not know if that is my problem or not. I am having problems upgrading the version of CYGWIN it hangs in post install, so I decided to grab another computer and install cygwin 32 on it, and it is running Windows 10. That is the second example. 


I this is the script: 
#!/bin/bash 
echo $PWD 
project_root=$PWD 
echo $project_root 
x=${project_root}/tools 
echo $x 
echo ${x} | cat -A 

On original Windows 7 computer I get: 
dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut 
$ ./testconvert1.sh 
/home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut 
/home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut 
/toolsdalkmora/walnut/dp2b_walnut_customer_flextronics/walnut 
/home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut^M/tools^M$ 

On new Windows 10 I get: 
dalkmora@DALM0255 ~/walnut 
$ ./testconvert1.sh 
/home/dalkmora/walnut 
/home/dalkmora/walnut 
/toolsdalkmora/walnut 
/home/dalkmora/walnut^M/tools^M$

So when I type the commands on the command line it works as I think it should.


dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut 
$ project_root=$PWD 

dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut 
$ echo $project_root 
/home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut 

dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut 
$ x=${project_root}/tools 

dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut 
$ echo $x 
/home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut/tools 


What am I doing wrong or is this an error? 
Where do the carriage returns (^M) come from, and how do I get rid of them? 

The FAQ says you want the results of cygcheck -s -v -r > cygcheck.out
it is attached. 

Kip

Attachment: cygcheck.out
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]