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:reply-to; q= dns; s=default; b=nPRKyOTkbn1Oe3P81nk80JZx6i+QZHwU0aVf7Yi/DfGWJz XzBWzuHiivgvv9OzOwhFQNmM6YN2zYa/lwiA+alWnCNsiu5onFUrxOiad9CANDAP 5IHgNJPdYaI4fukdTlVe2V25r+Kw1wKKL/P1pb+V4pAknA+sgO9WMneOVoy5Q= 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:reply-to; s= default; bh=GiNBksaGXip7XH02o5+FWY0s6Ok=; b=IWgF2NDdlW2lckRNiE/n XMvQUMdaQsVAwqt2wYOW9BGYtdYkGSRiZ6B16PfseHsX+3V2TrndysjQu22Sgqn8 cgRJU7YsDsbbMSqRkS2NVzFgEeZsh16/8TDz61o2sGQyKUzuw0hW1JXuamU+xtEb 8T+7YcIfAR1laATC/vkm9y0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=gem, bluetooth, Bluetooth, william X-HELO: blaine.gmane.org To: cygwin AT cygwin DOT com From: Will Parsons Subject: strange shell output using tcsh under Cygwin Date: Mon, 6 Nov 2017 00:15:25 +0000 (UTC) Lines: 126 Message-ID: Reply-To: wbparsons AT cshore DOT com User-Agent: slrn/1.0.3 (CYGWIN_NT-6.1) X-IsSubscribed: yes 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