query file name

Experts,

New Year Greetings to everyone!

Is there a way I can query the filename from the file itself?

I am writing a bunch of similar 'csh' scripts, which differ by the file name and same difference is inside the script.

e.g.

script1.run.csh

....
set vrbl = script1
....

script2.run.csh

....
set vrbl = script2
....

So if can somehow query the filename, I will be able to parse it and don;t have to manually edit the script file for these changes.

Any ideas, on how this can be accomplished?

Thanks,

Sumit

$0 is the name of the current file (in Bourne-based shells, at least).

it works!

Thanks a lot! :slight_smile:

You can also use 'echo ${0##/}' inside the script and if you want the value of this in a formatted way use as
echo ${0##
/} | tr '[:lower:]' '[:upper:]'

With Regards
Dileep