5

In bash you can use $0 variable to get the location of the current script. How I do the same in Nu? echo $nu doesn't seem to have anything I can use.

Jacob Wang
  • 4,411
  • 5
  • 29
  • 43

3 Answers3

4

As long as you know the name of the file, you can do:

$env.FILE_PWD | path join filename

This will only work if you are executing the file as a script, not sourcing it.

dols3m
  • 1,676
  • 2
  • 16
  • 25
0

I don't think there's a way to do this yet. I was playing with history | last but it's one off, as you'd expect.

Darren
  • 483
  • 7
  • 15
-1

($nu.config-path | path dirname )

jiahut
  • 1,451
  • 15
  • 14