X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 548F13858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca X-Authority-Analysis: v=2.4 cv=frTP2X0f c=1 sm=1 tr=0 ts=623aca77 a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17 a=IkcTkHD0fZMA:10 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10 Message-ID: Date: Wed, 23 Mar 2022 01:21:27 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Running a command in a specific directory Content-Language: en-CA To: cygwin AT cygwin DOT com References: <8034c9ba-8384-a239-faf8-e8376d6dbc2e AT gmail DOT com> From: Brian Inglis Organization: Systematic Software In-Reply-To: <8034c9ba-8384-a239-faf8-e8376d6dbc2e@gmail.com> X-CMAE-Envelope: MS4xfPydRU2c3z7+4iy8v7Y5ifpUqFF+Up5TcRFa37+0ptnDC2XgmhTuJOGXbVlXpXrTnX+C5+AhwXCug/dFy1hJ/+MjFNH9p/c6su68o1Nw9GeKa7TG21FL Qdl+4nlMGWe+KeNlumdELge/d1CG3kk/jO4EL3d+rHXKRrCpwwzyD51ulscd1pd5n3aeSKxygsUX2izGD56k8gSlKOBaYAa0xUo= X-Spam-Status: No, score=-1164.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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 AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 22N7Lkvr011088 On 2022-03-22 16:35, Piotr Gliźniewicz wrote: > 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? $ file `which xhere` /usr/bin/xhere: Bourne-Again shell script, ASCII text executable $ head `which xhere` #!/bin/bash # Have to use bash; can't get ash to "exec -l" # Separate script from chere to avoid need for argument parsing # # first arg is shell # second arg is the path ... Can't do that: xhere expects shell path /bin/*sh* and directory path and runs under bash so it can run exec -l to exec shell as login shell after cd dir. Starting XWin Server from a shortcut uses: C:\...\cygwin...\bin\run.exe --quote /bin/bash -l -c "cd; exec /bin/startxwin" so you could base a commnad line on that. You could also install and use Cygwin-X with a GUI file manager like PcManFM, or a text version like Midnight Commander (package mc). -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.] -- 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