cygwin - Command works in command line but gives 'no such file or directory' in bash script -


like tags say, in cygwin.

i have command line program can run cygwin console:

./optalg.exe data/5node/1.dat 500 2>&1 > output/1.out 

i wrote following bash script put in loop

#!/bin/bash  inputfile in data/5node/*.dat   outputfile=${inputfile##*/} #strip output name input name   outputfile=${outputfile%.*} #strip output name input file   outputfile+=".out"   "./optalg.exe $inputfile 500 2>&1 > output/$outputfile" done 

when run bash script, every iteration of loop 'no such file or directory', e.g.,

./batchopt.sh: line 8: ./optalg.exe data/5node/1.dat 500 2>&1 > output/1.out: no such file or directory 

what's happening here? i'm not sure i'm doing wrong.

remove quotes around line 8.
this:

./optalg.exe "$inputfile" 500 2>&1 > "output/$outputfile" 

by placing quotes around whole line tell bash execute command called ./optalg.exe $inputfile 500 2>&1 > output/$outputfile , of course there no such command. in reality want run ./optalg.exe parameters. not forget place quotes around variables because otherwise filenames have whitespace characters going passed several arguments.
please read arguments.
, can read common pitfalls well.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -