delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:to:from:subject:date:message-id:references | |
:reply-to; q=dns; s=default; b=yQC3dwU87BsVp/tccLmec77N4MpSSc5nR | |
p50ME5ZXTZvoHx8+qnNOBh4ZP+RcDJqpR/Er2Ox45kDomOvcbQ0KMQxt9Zo7ngYS | |
Ywsu81stpl4EmnDkYw6YnlrMlUlUQezzxEuLI/+zVbAxcbq3BHONmSW4eM1sIty6 | |
PB2jzhVlgA= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:to:from:subject:date:message-id:references | |
:reply-to; s=default; bh=rVg8cFobejE+boFp+B+fycHUodw=; b=OIDPblQ | |
D8ygZV+N2DXzCY3OKZMPm5MKrHLRUTdae1PXwo0r0RFYlZFA5yniBp2ezkKZl0Mv | |
boI0bea/RBlGJ2/IOS8Qv3RAOG5fRTj1azsZcFxIQt6iquS9WaUdnfnXaKKVr5uG | |
126HlxqU19osYRWiDPzJIY2slpLGmMJW8sug= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=1.8 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=bluetooth, Bluetooth, william, human |
X-HELO: | blaine.gmane.org |
To: | cygwin AT cygwin DOT com |
From: | Will Parsons <wbp AT nodomain DOT invalid> |
Subject: | Re: strange shell output using tcsh under Cygwin |
Date: | Mon, 6 Nov 2017 19:46:29 +0000 (UTC) |
Lines: | 117 |
Message-ID: | <otqe6l$77s$1@blaine.gmane.org> |
References: | <2fe1deabca1d4a2b90838b46437e34f6 AT DE013666 DOT schaeffler DOT com> |
Reply-To: | wbparsons AT cshore DOT com |
User-Agent: | slrn/1.0.3 (CYGWIN_NT-6.1) |
X-IsSubscribed: | yes |
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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |