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]

Re: Trouble with export


On Tue, May 08, 2007 at 09:40:32AM -0700, David Partridge wrote:
>I just installed cygwin (1.5.24-2) on a Windows Vista machine.
>When I execute a script file to set my environment variables,
>they look okay but don't actually work correctly.  The following
>example shows the difference between what happens when I execute
>the export command directly from bash and from the script.
>Note that the simple echo command appears to show that everything
>is fine, but the cd command fails, and when leading and trailing
>characters are echoed the variable defined in the script strangely
>shows up after the trailing characters.  I cut and paste the
>export command straight from the script file (both from the screen
>print and from withing vi), but it still always works from the
>command line and fails from the prompt.  This used to work just
>fine on an older version of cygwin running on windows XP.  I've
>recreated new test scripts from within cygwin to make sure there
>weren't any extra control characters, but that doesn't help.
>
>Any thoughts on what to try next would be greatly appreciated!
>
>$ cat set1
>export FRED=mydir
>
>blah@blah /cygdrive/c
>$ export FRED=mydir
>
>blah@blah /cygdrive/c
>$ cd $FRED
>
>blah@blah /cygdrive/c/mydir
>$ echo $FRED
>mydir
>
>blah@blah /cygdrive/c/mydir
>$ echo "##"$FRED"**"
>##mydir**
>
>blah@blah /cygdrive/c/mydir
>$ cd ..
>
>blah@blah /cygdrive/c
>$ . ./set1
>
>blah@blah /cygdrive/c
>$ cd $FRED
>: No such file or directory
>
>blah@blah /cygdrive/c
>$ echo $FRED
>mydir
>
>blah@blah /cygdrive/c
>$ echo "##"$FRED"**"
>**mydir
>
>blah@blah /cygdrive/c
>$ exit

I'd wager that "./set1" has \r\n line endings.  Running it through
dos2unix should fix it.

cgf

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


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