On 09/06/2016 05:36 PM, Kipton Moravec wrote: > I this is the script: > #!/bin/bash > echo $PWD
Insufficient quoting. This does not do the right thing if $PWD contains
spaces. But not necessarily related to your problem at hand.
> project_root=$PWD
> echo $project_root
Again, insufficient quoting.
> x=${project_root}/tools
> echo $x
And again.
> 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$
The carriage returns are likely a product of you editing the file in
text mode (Windows notepad is notorious for this, but many other native
programs do likewise), but trying to execute the script in binary mode
(the default, if you do not use 'set -o igncr').
> 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?
d2u /path/to/your/script
to remove all the carriage returns from your careless editing. Once they
are gone, then you don't need the 'igncr' crutch to tell bash to go into
text mode.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature

