Running a command in a specific directory

Eliot Moss moss@cs.umass.edu
Tue Mar 22 22:40:30 GMT 2022


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


More information about the Cygwin mailing list