I want to type only the filename of a gcc source that has ".syn" as an extension and copy it, changing the extension to ".c" so it can be compiled.
I do it as follows:
if (-e $1.syn) then
/bin/cp $1.syn $1.c
endif
This works fine, but if I want to repeat the compilation by recovering the previous call using history, the full filename plus the extension ".syn" appears and I have to delete the ".syn" to use my script.
Because so many programs give one an option of typing a filename with or without an ext, there must be a simple way to do this. How is it done?