The two lines below are what I have for my UNIX shell.

cobc -free -x -o$(basename "$1" .exe) "$1"

./$(basename "$1" .exe)

When I type:

./myshell file.cob   

...the program runs fine. But the original cobolfile (no extension) gets overwritten with compiled system code so the content looks exactly like the cobolfile.exe system code. So I can only run the program once then everything is lost... How to I tweak my shell program to avoid this?

Cheers!! :)

  • You tried to change the -o FILE_PATH to some other location? – snoop Oct 5 '15 at 8:29

The bash sample in the question seems to have been corrected - although it is quite strange to call an executable file ".exe" in a GNU/Linux system isn't it?

If you don't need the output file to be an executable I'd suggest to do

cobc -free $1
cobcrun $(basename "$1")

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.