-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Get a scripts current path #4842
Copy link
Copy link
Closed
Labels
category:enhancementNew feature or requestNew feature or request
Milestone
Description
Related problem
I want to write a script that uses relative paths to the script itself and not the called of the script, This enables the script to be run anywhere and not specifically in the script directory.
Describe the solution you'd like
I think it would be good to have some variable inside each script that enables you to access the path of the script.
dev/foo.nu
echo $CURRENT_SCRIPT_PATH
>> dev/foo.nu
Something like this, would be sufficient, Not to sure how this would work for multiple script files calling each other and vise versa?
Describe alternatives you've considered
Having an environment variable initialized once, and then using that inside the script instead, would be an alternative solution, but requires at least some configuration, but will work after done once.
Additional context and details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:enhancementNew feature or requestNew feature or request