Like Shooting Fish(shell) In A Barrel

Intel Operator
3 min readOct 9, 2021

A little gem! The Fish Shell https://fishshell.com/

TLDR; Simpler, faster stronger bash (no Kayne West)

A few months ago I needed a shell scripting language that suited my needs, that needed to be:

  • Faster than bash
  • Less words to type
  • Compact functions, loops and variable statements
  • Tab autocomplete; and
  • Make my life just that little bit easier (RSI).

So I found this gem, straight from the 90’s (not really); The Fish Shell

Fish shell can be your new best friend!

Lets crack on

Oh! A pretty/fine kettle of fish

Fish also have some really cool themes! If your anything like me and spend a lot of your time terminalingitup… Its better to look at something nice all day.

https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Themes.md

https://github.com/wyqydsyq/emoji-powerline

Don't let your scripts be so Dorring…

Don't be a fish out of water

I switch from bash to fish a few months ago and I have been trying to convince my friends (do I have any LOL) to try it out and give it a whirl. For me, it works amazingly so you should give it a go, bash could be your ex and fish could be your new lover!

A few examples, to get you interested!

Less code to type! Below are some examples of how it can make you code that little bit faster.

#whale meme (function) because...
function whale_meme
echo '''
":"
___:____ |"\/"|
, `. \ /
| O \___/|
~^~^~^~^~^~^~^~^~^~^~^~^~bloop'''
end
#testing things n stuff
if test -f blowhole.rb; and test -r blowhole.rb; echo works; else; echo "fail: broken file"; exit 1; end
#kill your ram with wayback machine and a list of urls
command cat domains.txt | while read -l foz; command wayback_machine_downloader -l $foz |jq -r '.[].file_url' >> urls.txt &; end
wait
#find text in a file
if grep -q neeeeemo thesea
echo "Dory said, I found you!"
else
echo "Nooooo"
end
#loopin
for file in*
echo found: $file
end
#sequencing
command cat "$argv[1]" |while read -l foo
for i in (seq 1 10)
command curl -s -m 10 --connect-timeout 10 'https://somesite/api/search?q="$foo"&page="$i'
end
end
#using a json file as a config file
set hunterio (command cat dna.json |jq -r '.hunter')
#abbr (abbrevations)
abbr -a -g curler "curl -s -m 10 --connect-timeout 10"
#saving functions! amazing
funcsave FUNCTION_NAME
funcsave [(-d | --directory) where/to/save ] FUNCTION_NAME
#string join
command cat list.ini |string join ,
dogs,cats,nemo,dory
#grep alernative
command cat ocean.txt |string match -r 'nemo|dory|shark'
nemo
#better TR lower...
echo NEMO |string match -r 'NEMO' |string lower
nemo
#edit all your configs! (opens config editor in browser)
fish_config
OR
fish_config browse
OR
fish_config prompt (choose | list | save | show)

--

--