0

I have a C program executable which required two arguments. The first argument is a abc.dat file and the second argument is abc.csv file. The program inputs the .dat file and converts it to a .csv file. The .dat exists when running the program and it creates the .csv which was the second argument.

I am trying to convert all the files in a folder using a bash script.

Here is my bash script:

#!/bin/sh

for file in /home/labadmin/Desktop/6122017/1252017
do
    ./my_read_bfee *.dat *.csv
done

When I execute the bash script I get:

usage: read_bfee in.dat out.csv

Please help. Thanks in advance.

1 Answer 1

2

maybe you wanted

#!/bin/sh

for file in /home/labadmin/Desktop/6122017/1252017/*.dat
do
    ./my_read_bfee "$file" "${file%.dat}.csv"
done

otherwise the *.dat inside the for loop is expanded to all files matching in current directory for each iteration

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

Comments

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.