Re: strange shell output using tcsh under Cygwin
- Date: Mon, 6 Nov 2017 11:42:30 +0000
- From: "Lemke, Michael ST/HZA-ZIC2" <lemkemch@xxxxxxxxxxxxxx>
- Subject: Re: strange shell output using tcsh under Cygwin
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
> 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:
> echo $PATH | tr ':' '\n'
>Oddly though, it does not give the expected results under Cygwin.
As you wrote you are using tcsh try this:
foreach i ( `seq 1 $#path` )
Or this slightly faster one:
@ i = 1
while ( $i < $#path )
Lookup arrays in tcsh.