* Re: strange shell output using tcsh under Cygwin
@ 2017-11-06 11:42 Lemke, Michael ST/HZA-ZIC2
2017-11-06 19:46 ` Will Parsons
0 siblings, 1 reply; 6+ messages in thread
From: Lemke, Michael ST/HZA-ZIC2 @ 2017-11-06 11:42 UTC (permalink / raw)
To: cygwin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1984 bytes --]
On Mon, 6 Nov 2017 00:15:25 +0000 (UTC)
Will Parsons wrote:
>Under Unix-type platforms, checking on what the PATH variable is set to is
>pretty easy - I typically use "env" and the displayed value of PATH is easily
>parsed by eye. Under Cygwin/Windows, one can do the same, but the value of
>PATH is more likely to be considerably more complicated and harder for a
>human to parse. For example, this is what I see on my local machine under
>Cygwin:
>
> PATH=/usr/local/bin:/usr/bin:/c/Windows/system32:/c/Windows:/c/Windows/system32/wbem:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/c/Program Files/Dell/DW WLAN Card:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/WIDCOMM/Bluetooth Software:/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/c/Program Files (x86)/Windows Live/Shared:/c/Program Files (x86)/Bazaar:/c/Program Files (x86)/QuickTime/QTSystem:/c/cygwin/home/william/bin:/c/ezwinports/bin:/c/Program Files (x86)/PuTTY:/usr/lib/lapack:/usr/sbin:/c/msys/1.0/local/bin
>
>I thought it would be nice to write a simple script to make this more
>comprehensible by breaking the path into separate lines, and so wrote the
>following trivial script:
>
> #!/bin/sh
> echo $PATH | tr ':' '\n'
>
>Oddly though, it does not give the expected results under Cygwin.
As you wrote you are using tcsh try this:
#!/bin/tcsh
foreach i ( `seq 1 $#path` )
echo $path[$i]
end
Or this slightly faster one:
#!/bin/tcsh
@ i = 1
while ( $i < $#path )
echo $path[$i]
@ i++
end
Lookup arrays in tcsh.
\0ТÒÐÐ¥\a&ö&ÆVÒ\a&W\x06÷'G3¢\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒ÷\a&ö&ÆV×2æFÖÀФd\x15\x13¢\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöf\x17\x12ðФFö7VÖVçF\x17Föã¢\x02\x02\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöFö72æFÖÀÐ¥Vç7V'67&&R\x06æfó¢\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöÖÂò7Vç7V'67&&R×6×\x06ÆPÐ Ð
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: strange shell output using tcsh under Cygwin
2017-11-06 11:42 strange shell output using tcsh under Cygwin Lemke, Michael ST/HZA-ZIC2
@ 2017-11-06 19:46 ` Will Parsons
2017-11-07 14:58 ` cyg Simple
0 siblings, 1 reply; 6+ messages in thread
From: Will Parsons @ 2017-11-06 19:46 UTC (permalink / raw)
To: cygwin
Lemke, Michael ST/HZA-ZIC2 wrote:
> On Mon, 6 Nov 2017 00:15:25 +0000 (UTC)
> Will Parsons wrote:
>
>>Under Unix-type platforms, checking on what the PATH variable is set to is
>>pretty easy - I typically use "env" and the displayed value of PATH is easily
>>parsed by eye. Under Cygwin/Windows, one can do the same, but the value of
>>PATH is more likely to be considerably more complicated and harder for a
>>human to parse. For example, this is what I see on my local machine under
>>Cygwin:
>>
>> PATH=/usr/local/bin:/usr/bin:/c/Windows/system32:/c/Windows:/c/Windows/system32/wbem:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/c/Program Files/Dell/DW WLAN Card:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/WIDCOMM/Bluetooth Software:/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/c/Program Files (x86)/Windows Live/Shared:/c/Program Files (x86)/Bazaar:/c/Program Files (x86)/QuickTime/QTSystem:/c/cygwin/home/william/bin:/c/ezwinports/bin:/c/Program Files (x86)/PuTTY:/usr/lib/lapack:/usr/sbin:/c/msys/1.0/local/bin
>>
>>I thought it would be nice to write a simple script to make this more
>>comprehensible by breaking the path into separate lines, and so wrote the
>>following trivial script:
>>
>> #!/bin/sh
>> echo $PATH | tr ':' '\n'
>>
>>Oddly though, it does not give the expected results under Cygwin.
>
> As you wrote you are using tcsh try this:
>
> #!/bin/tcsh
> foreach i ( `seq 1 $#path` )
> echo $path[$i]
> end
>
> Or this slightly faster one:
>
> #!/bin/tcsh
> @ i = 1
> while ( $i < $#path )
> echo $path[$i]
> @ i++
> end
>
> Lookup arrays in tcsh.
Thanks for the suggestion, but oddly enough, both the two versions of a tcsh
script you give yield the same result.
As an experiment, I modified the latter script to prepend an 'x' to the path
components:
#!/bin/tcsh
@ i = 1
while ( $i < $#path )
echo "x$path[$i]"
@ i++
end
and got the following results:
x/usr/local/bin
x/usr/bin
x/bin
x/usr/sbin
x/usr/local/bin
x/usr/bin
x/bin
x/usr/sbin
x/c/Windows/system32
x/c/Windows
x/c/Windows/system32/wbem
x/c/ProgramData/Oracle/Java/javapath
x/c/Program
xFiles/Common
xFiles/Microsoft
xShared/Windows
xLive
x/c/Program
xFiles
x(x86)/Common
xFiles/Microsoft
xShared/Windows
xLive
x/c/Program
xFiles/Dell/DW
xWLAN
xCard
x/c/Program
xFiles
x(x86)/Intel/iCLS
xClient
x/c/Program
xFiles/Intel/iCLS
xClient
x/c/Windows/System32/WindowsPowerShell/v1.0
x/c/Program
xFiles/WIDCOMM/Bluetooth
xSoftware
x/c/Program
xFiles/WIDCOMM/Bluetooth
xSoftware/syswow64
x/c/Program
xFiles
x(x86)/Windows
xLive/Shared
x/c/Program
xFiles
x(x86)/Bazaar
x/c/Program
xFiles
x(x86)/QuickTime/QTSystem
x/c/cygwin/home/william/bin
x/c/ezwinports/bin
x/c/Program
xFiles
x(x86)/PuTTY
But regardless of solving the original problem, I'd still like to know why
the original script doesn't work under tcsh only.
--
Will
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* strange shell output using tcsh under Cygwin
@ 2017-11-06 0:15 Will Parsons
2017-11-06 2:50 ` Andrey Repin
0 siblings, 1 reply; 6+ messages in thread
From: Will Parsons @ 2017-11-06 0:15 UTC (permalink / raw)
To: cygwin
Under Unix-type platforms, checking on what the PATH variable is set to is
pretty easy - I typically use "env" and the displayed value of PATH is easily
parsed by eye. Under Cygwin/Windows, one can do the same, but the value of
PATH is more likely to be considerably more complicated and harder for a
human to parse. For example, this is what I see on my local machine under
Cygwin:
PATH=/usr/local/bin:/usr/bin:/c/Windows/system32:/c/Windows:/c/Windows/system32/wbem:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/c/Program Files/Dell/DW WLAN Card:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/WIDCOMM/Bluetooth Software:/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/c/Program Files (x86)/Windows Live/Shared:/c/Program Files (x86)/Bazaar:/c/Program Files (x86)/QuickTime/QTSystem:/c/cygwin/home/william/bin:/c/ezwinports/bin:/c/Program Files (x86)/PuTTY:/usr/lib/lapack:/usr/sbin:/c/msys/1.0/local/bin
I thought it would be nice to write a simple script to make this more
comprehensible by breaking the path into separate lines, and so wrote the
following trivial script:
#!/bin/sh
echo $PATH | tr ':' '\n'
Oddly though, it does not give the expected results under Cygwin. Running
this script under Cygwin under my normal interactive script (tcsh) yields the
following:
% ./path
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/c/Windows/system32
/c/Windows
/c/Windows/system32/wbem
/c/ProgramData/Oracle/Java/javapath
/c/Program
Files/Common
Files/Microsoft
Shared/Windows
Live
/c/Program
Files
(x86)/Common
Files/Microsoft
Shared/Windows
Live
/c/Program
Files/Dell/DW
WLAN
Card
/c/Program
Files
(x86)/Intel/iCLS
Client
/c/Program
Files/Intel/iCLS
Client
/c/Windows/System32/WindowsPowerShell/v1.0
/c/Program
Files/WIDCOMM/Bluetooth
Software
/c/Program
Files/WIDCOMM/Bluetooth
Software/syswow64
/c/Program
Files
(x86)/Windows
Live/Shared
/c/Program
Files
(x86)/Bazaar
/c/Program
Files
(x86)/QuickTime/QTSystem
/c/cygwin/home/william/bin
/c/ezwinports/bin
/c/Program
Files
(x86)/PuTTY
/usr/lib/lapack
Clearly the path is being broken using spaces as well as colons.
Even thoush the shell script itself explicitly specifies "/bin/sh", the
result seems to depend on the shell being used to invoke it. Using Cugwin
bash, the same script results in the following:
sothis$ ./path
/usr/local/bin
/usr/bin
/c/Windows/system32
/c/Windows
/c/Windows/system32/wbem
/c/ProgramData/Oracle/Java/javapath
/c/Program Files/Common Files/Microsoft Shared/Windows Live
/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live
/c/Program Files/Dell/DW WLAN Card
/c/Program Files (x86)/Intel/iCLS Client
/c/Program Files/Intel/iCLS Client
/c/Windows/System32/WindowsPowerShell/v1.0
/c/Program Files/WIDCOMM/Bluetooth Software
/c/Program Files/WIDCOMM/Bluetooth Software/syswow64
/c/Program Files (x86)/Windows Live/Shared
/c/Program Files (x86)/Bazaar
/c/Program Files (x86)/QuickTime/QTSystem
/c/cygwin/home/william/bin
/c/ezwinports/bin
/c/Program Files (x86)/PuTTY
/usr/lib/lapack
/usr/sbin
/c/msys/1.0/local/bin
For comparison, I tried running the same script under FreeBSD (where tcsh is
also my normal interactive shell). Since paths with spaces are quite rare
under Unix-type systems, I added a dummy 'x x' (imaginary directory) to the
path. The result was as follows:
% ./path
/sbin
/bin
/usr/sbin
/usr/bin
/home/william/bin
/home/william/.gem/ruby/2.3/bin
/usr/local/sbin
/usr/local/bin
x x
So, I am quite puzzled.
--
Will
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-07 14:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 11:42 strange shell output using tcsh under Cygwin Lemke, Michael ST/HZA-ZIC2
2017-11-06 19:46 ` Will Parsons
2017-11-07 14:58 ` cyg Simple
-- strict thread matches above, loose matches on Subject: below --
2017-11-06 0:15 Will Parsons
2017-11-06 2:50 ` Andrey Repin
2017-11-06 19:14 ` Will Parsons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).