Bash script - command works directly in command line but not in script
When I run my executable code from the command line,
Code:
./optAlg data/1.dat 50000 I want to wrap it in a loop in bash. When I put it in the loop shown below, I get Code:
What am I doing wrong? The code that gives the error: Code:
#!/bin/bash |
Code:
#!/bin/bash |
Ah, you got me. It's cygwin. I wasn't sure if I would get 'no cygwin questions here, it's not actually Linux' but I didn't really want to get into that.
|
drop the "s
shell is seeing it as one 'long' command |
Well hiding the environment is not a good way to ask a question, might be important, so it is best to be honest and complete when asking questions - you get better answers.
I don't know cygwin, but in your example in the first instance where you say it works, it is just optAlg, then when you posted the script code it is optAlg.exe. So are they supposed to be the same? Are they actually different as shown? If different, then make your script the same as the shell command that works. Looks like Firerat spotted the (other) problem. |
It was the quotes. I thought I needed them in order for it to know $inputFile was a variable, but I guess not.
|
yeah, really the quotes should be round the $var
|
All times are GMT -5. The time now is 10:39 PM. |