Convert bash function to fish's [closed]

Some notes on the differences:

  • setting variables
    • bash: var=value
    • fish: set var value
  • functions
    • bash
      funcName() {
          ...
      }
      
    • fish
      function funcName
          ...
      end
      
  • function arguments
    • bash: "$@"
    • fish: $argv
  • function local variables
    • bash: local var
    • fish: set -l var
  • conditionals I
    • bash: [[ ... ]] and [ ... ]
    • fish: test ... and [ ... ]
  • conditionals II
    • bash: if cond; then cmds; fi
    • fish: if cond; cmds; end
  • conditionals III
    • bash: cmd1 && cmd2
    • fish: cmd1; and cmd2
    • fish (as of fish 3.0): cmd1 && cmd2
  • command substitution
    • bash: output=$(pipeline)
    • fish: set output (pipeline)
  • process substitution
    • bash: join <(sort file1) <(sort file2)
    • fish: join (sort file1 | psub) (sort file2 | psub)

Documentation

  • bash: https://www.gnu.org/software/bash/manual/bashref.html
  • fish: http://fishshell.com/docs/current/index.html