tcsh - How do I get `__FILE__` when sourcing a csh script -


i have script used set env vars in calling csh shell. of variables depend on location of script.

if file proper csh script, can use $0 access __file__ if run script using source, tells me csh or tcsh.

since i'm using set vars in parent shell, have use source.

what do?

if access $_ on first line of file, contain name of file if it's sourced. if it's run directly $0 contain name.

#!/bin/tcsh set called=($_) if ($called[2] != "") echo "sourced: $called[2]" if ($0 != "tcsh") echo "called: $0" 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -