Error : command not found

Hi ,

I am an Oracle developer. trying to write a shell script to compile all the forms that are modified in last 1 hour.

Script Body

cat cmp.sh
for f in `find ./*fmb* -mmin -60`; do "`frmcmp_batch.sh userid=ba/ba@testdb batch=yes module=$f module_type=form compile_all=yes window_state=minimize`"; done
for f in `find ./*err* -mmin -60`; do "`tail -1 $f`"; done

This is what I am trying to do in script above.

  1. Search all the forms (*.fmb) in current directory that are modified in last 1 hour.
  2. Compile forms from step 1 using forms compiler utility script frmcmp_batch.sh.
  3. Print the last line of corresponding .err file created after compilation of each form.

Though the script runs as expected and compiles forms but it also gives error messages like

./cmp.sh
./cmp.sh: line 1: : command not found
./cmp.sh: line 2: Created form file ./test.fmx: No such file or directory

Note: Text Created form file ./test.fmx is output of tail command.

Please let me know the reason for command not found and No such file or directory errors.

Thanks,
Imran.

"command substitution" ($(...) or (deprecated) `...`) allows the output of a command to replace the command name. (c.f. man bash )
I guess frmcmp.batch.sh doesn't produce any output on stdout, so the do loop tries to run an empty command resulting in the first error message. Same for the second - tries to run "Created form file ./test.fmx" which cannot be found.

Remove double quotes and backticks and try again.

1 Like