Hacker News new | past | comments | ask | show | jobs | submit login

My best progress in shell was by switching to Fish. Much more intuitive for programmer. Guess what this does:

  while true
    clear
    df
    sleep 1
  end



I second this. No shortcut to search history, just start typing and hit up. Instead of ctrl-e or whatever it is, it has the same "move by 1 word" shortcut as literally everything else on the computer. The pre-made prompt configurations that you can browse (with preview!) in a web browser is nice too. ZSH doesn't compare imo.


Interestingly, none of the two Bash versions in the comments are equivalent to your code, which kind of prove your point with Bash being tricky. `while sleep 1` means the script will sleep once before running `df`, while it should only sleep after. The other command also won't work because it's missing colons between commands.


The point I wanted to make was that OP sacrificed compatibility with all major distros for being rid of "; do", essentially.

I just don't see the point. Bash might have flaws, nothing is perfect, but it's one vital piece of software that most distros have installed.


  while sleep 1; do
    clear
    df
  done


watch -n1 df


I second the voices, one downvoted but none really addressed, wondering why this is manifestly an improvement over the bash equivalent.

I certainly don't demand that everything in Fish be an improvement over everything in bash for Fish to nonetheless be superior... but this was presented specifically as an example of how Fish is great, and I could just as well say "Guess what this does" of the obvious bash equivalent:

    while true; do
        clear
        df
        sleep 1
    end


*done


Eep, yes.




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

Search: