delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/11/06/06:42:50

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:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=pxb
Q5P+7+zNBBlE4jxP3kO1PRxG7SMrgtx/nXyHE8vI4K7oJxOfsCska1693ga8aPpZ
T+iaCgIdJ4wlO6h+/YlHXrGuo1Hv0B8aaZS3doDTzMYsDAytZCZlwYD7u27RHSZl
+cyU4Ns0WH4xr+wKCorqzPQQwqqYn12pmr8YCSmA=
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:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=/bgeMmXcX
GpP3B3LfxwEz7tb/fw=; b=ilEak2PIVvoR6IGbYfsKOUErs4S3jm/fixz8UAqW7
5cFY1DVS5oy27i3xbtfqqMdQK8Q72kCFnoGISBZdI6LgCSDOcD6uaryZGPUdVh35
ZuF9Ykj0q6zcAw+JrUXdhZ8camNAhTs/+ty1LqG560QCn/jcz4hzEaBNDdJE5UrG
HI=
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: Yes, score=5.0 required=5.0 tests=AWL,BAYES_40,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=bluetooth, Bluetooth, william, considerably
X-HELO: cluster-j.mailcontrol.com
From: "Lemke, Michael ST/HZA-ZIC2" <lemkemch AT schaeffler DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: strange shell output using tcsh under Cygwin
Date: Mon, 6 Nov 2017 11:42:30 +0000
Message-ID: <2fe1deabca1d4a2b90838b46437e34f6@DE013666.schaeffler.com>
x-ms-exchange-transport-fromentityheader: Hosted
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id vA6Bgn8f009365

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.


--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019