I'm trying to get SBT running using the Fish shell. Below is the equivalent Bash script of what I'm trying to achieve:
java -Xmx512M -jar `dirname $0`/sbt-launch.jar "$@"
I see in the Fish documentation that $@
in Bash can be replaced with $argv
in Fish.
But I cannot see what to replace dirname $0
with.
Does anyone know the equivalent script in Fish?
pwd can be used to find the current working directory, and dirname to find the directory of a particular file (command that was run, is $0 , so dirname $0 should give you the directory of the current script).
To be able to run fish scripts from your terminal, you have to do two things. Add the following shebang line to the top of your script file: #!/usr/bin/env fish . Mark the file as executable using the following command: chmod +x <YOUR_FISH_SCRIPT_FILENAME> .
The configuration file runs at every login and is located at ~/. config/fish/config. fish . Adding commands or functions to the file will execute/define them when opening a terminal, similar to .
$_ only seems to work directly via the reader/command line, or when the script is sourced, for me.
Maybe this will work for you:
java -Xmx512M -jar (dirname (status -f))/sbt-launch.jar "$argv" # fish
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With