5 ms·
I have been using fish for several years now. It's community is a fraction of zsh, bash, and others, and I've tried to go back to them, mostly out of misplaced
by ramLlama 15y ago
I have been using fish for several years now. It's community is a fraction of zsh, bash, and others, and I've tried to go back to them, mostly out of misplaced "everyone else is doing it" mindset
Fish is a great shell. It's a modern shell, that uses colors, UTF, and processing power that didn't exist when the others were designed. I feel the best thing about it is the sane defaults and large number of prebuilt completions. For any other shell, I have to dive into bashrc's and esoteric commands to get what I want. Fish just does what I want. It's made me far more productive, and for that, it gets my best shell award.
Its scripting support is good, very similar to other shells. Yes, the syntax is non-compatible, and not even POSIX. But, it makes more sense. Besides, for anything except the simplest of scripts, I use lua. I doubt you'd want to use bash to do something very complicated.
Some people want their shell scripts to be compatible and do a lot of cool things. I feel that the days of a shell being used for scripting are past. For me, a shell is a way of interacting with the system. Fish does this really well. Scripting is a slight afterthought, as it should be.
- andrewflnr 15y agoDo you have to do anything weird to Lua to make it work as a system scripting language? Do you just use the built in OS interfaces?
- ramLlama 15y agoYes, I just use the builtin's. Basically os.execute, and io.popen. Popen is not the greatest because you can't get exit statuses from it. But for a quick script that is too messy in shell, it suffices. I believe that there is an extension to lua that has a popen that returns exit statuses. That can be used too. For pattern matching, I either pipe to perl and capture the output, or use the inbuilt pattern matching system. It's surprisingly powerful.
- xolox 15y agoSince Lua 5.2 (just released) the pipe:close() method returns the exit status of the command. For more information see http://www.lua.org/manual/5.2/manual.html#pdf-file:close http://www.lua.org/manual/5.2/manual.html#pdf-file:close You can also get the exit status using Lua 5.1 but it's definitely nasty (io.popen('your-command; echo $?') and the last line of output is the exit status).
- mixmastamyk 15y agoSame here, the syntax highlighting rocks (I couldn't go back now), and I do like the shared history. For simple non-interactive scripts I still use bash because of its ubiquity, python for complex needs.
- pyre 15y ago> I do like the shared history. Maybe the implementation is different, but ZShell has shared history. (Just noting that this is not a 'fish rocks other shells because of X' feature)
- mixmastamyk 15y agoYep, this thread is currently under several comments talking/complaining about zsh shared history. I'm in the "appreciate" camp.
- rhizome 15y agoI feel that the days of a shell being used for scripting are past. I've noticed this attitude among those who tend to use sysadmin-minimizing features of the internet, such as cloud hosting. There's still a whole world of real server out there, though.
- xolox 15y agoI get what you're saying but have to say that since I've started doing more deployments in AWS I'm writing more and more shell scripts. Any given Linux AMI will support Bash and even though shell scripts are painful to write and maintain, doing the equivalent in e.g. Python is painful as well :-(
- ramLlama 15y agoThat is true. I do minimal system administration, so that is not a concern for me. I tend to use a shell for system interaction more than scripting. In that regard, I give more importance to interactivity enhancements. On the other hand, I have found myself using bash to automate simple things in our company testbed. As soon as I need a datastructure more than an array, or recursive functions, I jump to lua. If your primary job is to be a sysadmin, then Bash is Required Reading.
- ralph 15y agoI disagree. As a programmer I can represent inputs and outputs as text and write code to do intended transformations. As a quick ad hoc test I can easily knock up a shell pipeline to give confidence in those results, even if it would be too slow for production. There's many occasions when powerful shell usage is quicker to write than Python, etc. My comment in reply to http://www.iheartchaos.com/post/16393143676/fun-with-math-dividing-one-by-998001-yields-a#comment-419334498 http://www.iheartchaos.com/post/16393143676/fun-with-math-di... is one example.
- derleth 15y agoThis might be one reason fish isn't more widely used. To quote from the documentation[1]: Configurability is the root of all evil [1] http://fishshell.com/user_doc/design.html#conf http://fishshell.com/user_doc/design.html#conf As long as the people designing fish believe that, it will be unsuitable for people who want or need customized solutions. That describes a lot of people using shells now.
- crazydiamond 15y agoI tried out fish a month back, but got stuck on 2 things, one which i use frequently. 1. I use the Alt-. (dot) to get last argument of previous command. 2. Getting output of previous command such as : `!!` (backtick !! backtick) for which I get a "no such file". I asked on reddit, but got no replies. Thx.
- bellbind 15y ago!! is not specific to fish. It is a history feature to get the last command. It's like using '!ec' for getting the last command that starts with 'ec'. Using `!!` is not "getting output of previous command", it is re-executing it and getting that output. For that alt+. tip, I'd use the special $_ var.
- crazydiamond 15y agoYou haven't told me how to do a `!!` in fish. (I do understand that it re-executes the previous command). I am used to using this in other shells like bash and zsh, and would like to know if there's some way of doing it in fish.
- bellbind 15y agoAFAIK this is not possible with fish, as variables cannot be used as commands like in bash (and the ! history feature does not exist in fish, it is designed to be fully interactive). See http://fishshell.com/user_doc/faq.html#faq-history http://fishshell.com/user_doc/faq.html#faq-history