Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Syntax. I much prefer the fish syntax, even though the fact that it's different from bash can occasionally cause headaches. When I'm mucking with my shell, I'd rather not be remembering [[ -z ]], because I don't do it often.

Basically most shells are designed around power, which is fine. Fish is designed around ease-of-use, which I consider to be a better idea since there's already a ton of power in the UNIX tools that are on the system. That's not to say fish isn't powerful, mind you. Just that you detect a different emphasis when using it.

Consider setting colors in a prompt, for example. zsh and bash use PS1=$'\e[0;31m$ \e[0m'. Ouch. More recent versions of zsh do let you do PS1="%{$fg[red]%}%n" type stuff, I'll confess.

For fish, setting up a colored prompt or whatever:

  function fish_prompt -d "Write out the prompt"
    printf '%s%s@%s%s' (set_color brown) (whoami) (hostname|cut -d . -f 1) (set_color normal) 

    # Color writeable dirs green, read-only dirs red 
    printf ' %s%s' (set_color green) (prompt_pwd)

    # Print git branch
    if test -d ".git"
      printf ' %s%s/%s' (set_color normal) (set_color blue) (parse_git_branch)
    end 
    printf '%s> ' (set_color normal)
  end
It's stuff you already know how to do. It's not an environment variable, it's a function. Commands you use normally. Invoking other regular fish functions/commands. Etc etc. It just feels cleaner (to me).


Ah, so a lot of it is that you like the config language better! That would not have occurred to me. Thank you for your reply.


The biggest draw of fish is the syntax highlighting at the command line. I still write scripts in bash though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: