Andrew Mould
2023-03-26 21:06:17 UTC
Anyone know of a method or trick to reliably determine the full filename (ie including subvolume) of a TACL script file when it's executed? Something like the equivalent of Bash's $0 variable?
I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.
Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.
I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!
- Andrew
I often want to know where the script file is located in order to find related files in the same subvolume. The only reliable way I see to achieve this is to pass the subvolume info in to the script as a param. Every time I face this problem I think there has to be a better way.
Note I want this to be reliable. There are convoluted tricks you can do when operating at the command line, which don't work when a script file is invoked from another TACL macro / routine.
I don't hold out much hope. The TACL reference manual itself says: "...a routine stored in a ?TACL ROUTINE file cannot determine the name of the file it is stored in...". But I thought I'd poll the collective brain trust!
- Andrew