X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CADBF3858401
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=cs.umass.edu
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.umass.edu
Subject: Re: Running a command in a specific directory
To: =?UTF-8?Q?Piotr_Gli=c5=baniewicz?= <glizda@gmail.com>, cygwin@cygwin.com
References: <8034c9ba-8384-a239-faf8-e8376d6dbc2e@gmail.com>
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <e211ecd7-8d88-c353-20c9-66f4c77cfd6e@cs.umass.edu>
Date: Tue, 22 Mar 2022 18:40:30 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
 Thunderbird/68.12.1
MIME-Version: 1.0
In-Reply-To: <8034c9ba-8384-a239-faf8-e8376d6dbc2e@gmail.com>
Content-Language: en-US
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL,
 KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Reply-To: moss@cs.umass.edu
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 22MMf9g3026373

On 3/22/2022 6:35 PM, Piotr Gliźniewicz wrote:
> Hi,
> 
> I'm trying to run a command at a specific "Windows" path. Basically something similar to what chere 
> does for bash, but I want to execute ls in bash for a specific directory. I've tried variations of 
> what chere leaves in the registry:
> 
> C:\cygwin64\bin\bash.exe -c "/bin/xhere /bin/bash.exe '%L'"
> 
> Adding simply `-c ls` didn't work.
> 
> To start with something simpler I've launched bash and tried just to guess what xhere want's, but I 
> don't really know what's happening. I couldn't find any help for xhere.
> 
> /cygdrive/c
> $ /bin/xhere '/bin/bash.exe -c ls' d:
> /bin/xhere: line 38: [: too many arguments
> /bin/xhere: line 41: [: too many arguments
> /bin/xhere: line 64: [: too many arguments
> Starting /bin/bash.exe -c ls
> -/bin/bash: ls: command not found
> 
> /cygdrive/c
> $ /bin/xhere "/bin/bash.exe -c ls" d:
> /bin/xhere: line 38: [: too many arguments
> /bin/xhere: line 41: [: too many arguments
> /bin/xhere: line 64: [: too many arguments
> Starting /bin/bash.exe -c ls
> -/bin/bash: ls: command not found
> 
> Any hints, how to properly pass `/bin/bash.exe -c ls` to xhere?

I'm not familiar with xhere; I would just do something like:

C:\cygwin64\bin\bash.exe -c "cd place/I/want/to/be; ls"

Cheers - EM

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

