Quantcast
Channel: User Dennis Williamson - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 61

Answer by Dennis Williamson for How can I convert this bash function to the fish shell

$
0
0

Here is a working function that's similar to your test function.

 function testvarz
      switch (count $argv)
          case 0
              echo 'zero'
          case 1
              echo "one $argv[1]"
          case 2
              echo "two $argv[1] $argv[2]"
          case '*'
              echo 'else'
      end
  end

You can use a similar structure for your connect function.

By the way, you should similarly use $# in your Bash function instead of trying to rely on $2 being null. You can also use a case statement in Bash.


Viewing all articles
Browse latest Browse all 61


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>