Convert bash function to fish's [closed]
Some notes on the differences:
- setting variables
- bash:
var=value
- fish:
set var value
- bash:
- functions
- bash
funcName() { ... }
- fish
function funcName ... end
- bash
- function arguments
- bash:
"$@"
- fish:
$argv
- bash:
- function local variables
- bash:
local var
- fish:
set -l var
- bash:
- conditionals I
- bash:
[[ ... ]]
and[ ... ]
- fish:
test ...
and[ ... ]
- bash:
- conditionals II
- bash:
if cond; then cmds; fi
- fish:
if cond; cmds; end
- bash:
- conditionals III
- bash:
cmd1 && cmd2
- fish:
cmd1; and cmd2
- fish (as of fish 3.0):
cmd1 && cmd2
- bash:
- command substitution
- bash:
output=$(pipeline)
- fish:
set output (pipeline)
- bash:
- process substitution
- bash:
join <(sort file1) <(sort file2)
- fish:
join (sort file1 | psub) (sort file2 | psub)
- bash:
Documentation
- bash: https://www.gnu.org/software/bash/manual/bashref.html
- fish: http://fishshell.com/docs/current/index.html