0

I am trying to execute the following command in a shell script :

find "$1" -type f -name "*.DAT" -exec sed -e 's/.*/\"&\"/' {} ';' -exec xargs wc -l ';'

the command is supposed to run from a windows batch file as follows:

set arg1=%1
C:\cygwin64\bin\bash.exe row_count.sh %arg1%

Where row_count.sh is the shell script containing the find command above. The user is supposed to pass in a folder path to the batch file which is then supposed to pass on the folder path parameter to the find command in the shell script.

But I am getting following error:

FIND: Invalid Switch

please help.

1 Answer 1

1

FIND: Invalid Switch is a error message from windows find not from cygwin one.

So you need to use a login shell to properly set the PATH

C:\cygwin64\bin\bash.exe -l row_count.sh %arg1%

In addition be sure to put on the first row of row_count.sh the #!/bin/bash

Sign up to request clarification or add additional context in comments.

3 Comments

now it is saying /usr/bin/bash: row_count.sh: No such file or directory
row_count.sh and word_count.bat both are in C:\
Put those files in your Cygwin home directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.