Live data from Hacker News

Fish: Finally, a command line shell for the 90s

ridiculousfish.com

111–120 of 155 posts

Re: Fish: Finally, a command line shell for the 90s

#111

Earlier quoted context omitted.

I never use alias in fish, just functions - see the Fish design document, law of orthogonality: http://fishshell.com/user_doc/design.html#ortho That infinite loop thing is a bug for sure, it shouldn't do that! I have defined that type of function to jump to the directories of current projects - that should work.

> I have defined that type of function to jump to the directories of current projects - that should work. What do you mean? Even if I define a function like so: function foo; cd /var; end It shouldn't automatically execute the function and cd into /var.

No, exactly, for me it wouldn't.

For example, I'd type something like this:

  function gogogo
    cd ~/src/teh_project
  end
  funcsave gogogo
Then the "gogogo" function is available in all shells and loaded on startup - but not executed until I do so myself. From what I understand you wish to have the same functionality, and are doing the same thing, but are getting totally weird results.

Explicitly: No, it definitely shouldn't try to run functions right away. Bug!

FWIW I haven't tried the fishfish fork/update, just used the original version for a number of years.

It'd be greatly appreciated if you could spare a moment to send a bug report! (I'm not a dev by any means, just a fish lover ...)

Re: Fish: Finally, a command line shell for the 90s

#112
post #45

Earlier quoted context omitted.

Bash too can do that. It does by default in Debian for instance, it also does cool things like autocompleting filenames based on which command is already typed (so it won't autocomplete to some pdf filename if the command is mplayer), autocompletion depending on config files (alias from ~/.ssh/config and /etc/hosts, remotes from the git config, package names when the command is apt-*…). About fish, for the history ba…

Bash's auto completion is a child's toy compared to Zsh's.

People say this kind of thing a lot, but I’m pretty sure it’s simply not true. bash-completion handles pretty much everything I can imagine already, and can be extended to handle anything you can express programmatically.

Re: Fish: Finally, a command line shell for the 90s

#113

Why does xargs under fish not accept {} as a replstr like it does with bash? find . | xargs -I {} grep pat {} On OS X fish this gives "xargs: replstr may not be empty" and on Linux fish I get "xargs: command too long". Using % as the replstr for example does work though.

The beauty of fish is that it handles lists much better than bash - it kind of has xargs "baked in". If I understand the example correctly, it finds every file under the current directory and greps for "pat" in each file.

In fish you could do this:

  grep pat (find .)
... or this:

  for i in (find .)
    grep pat $i
  end
The first example would work correctly in fish, but AFAIK it wouldn't work in bash. The is because every line from the command substitution is automatically escaped and quoted in fish. The small drawback is that a symbol-heavy commandline sometimes needs a few extra \ escapes - the power to handle lists of lines (i.e. lines from stdin or from command substitution) is bought for a little extra escaping. And it's a good deal IMO.

And the for loop in fish is so elegant and convenient that it's worth using for small random stuff.

(Everything I say is pending that I understand the find/xargs/grep example!)

Re: Fish: Finally, a command line shell for the 90s

#114

Why does xargs under fish not accept {} as a replstr like it does with bash? find . | xargs -I {} grep pat {} On OS X fish this gives "xargs: replstr may not be empty" and on Linux fish I get "xargs: command too long". Using % as the replstr for example does work though.

I'm not sure why the recommended replacement string to use with xargs's -I is "{}". I just use "XXX" as the replacement string and stop worrying about how the shell is interpreting metacharacters in this particular case:

    find . | xargs -I XXX grep pat XXX

Re: Fish: Finally, a command line shell for the 90s

#115

Very poor support for alias: batman@batman ~/D/S/rails> alias foo="cd ~/" fish: Could not expand string '$tmp[2]' /usr/local/share/fish/functions/alias.fish (line 19): set body $tmp[2] ^ in function 'alias', called on standard input, with parameter list 'foo=cd ~/' Makes me wonder what else I'll have to relearn to use fish. Can someone tell me if it's worth the effort? Edit: didn't take me long to find something wors…

It totally worths the effort. It wouldn't take more than an hour, but even if it would take you 10 hours, it would still worth the time.

Re: Fish: Finally, a command line shell for the 90s

#116

They need to update the slogan? "A command line shell for the 90s" doesn't really draw me in. What I want to know: 1. In what specific ways is it better than zsh? 2. Is it absolutely, rock-solid stable?

1) I don't know. I haven't dug that far into zsh, I didn't like it on the surface. Or rather I love both surface and depth of fish enough that I haven't yet investigated zsh.

Maybe you could tell us? Here's a pretty good article on fish by its original author: http://arstechnica.com/information-technology/2005/12/linux-...

Re: Fish: Finally, a command line shell for the 90s

#117
post #110

Under the known bugs and issues: History file should apply some kind of maximum history length Fine, but the default needs to be large, like 100MB. Disks are big now. I hope ridiculousfish agrees.

100 MB is indeed small but there are privacy concerns with storing hundreds of thousands of lines of history. Do you really want every command you've typed for the last several years to be visible to anyone with physical access to your box? It could contain clear-text passwords to other machines. I'd be happy with 100 MB as a maximum size but there should also be time-based limits, like remove anything from history t…

Just FYI, You can hide sensitive commands (like those that require you to type your password in plain!) in bash, by simply adding an space at the beginning (after adding `export HISTCONTROL=ignorespace` in your bash_profile, of course). I don't know about fish yet.

more: http://www.linuxjournal.com/content/using-bash-history-more-...

Re: Fish: Finally, a command line shell for the 90s

#118

Very poor support for alias: batman@batman ~/D/S/rails> alias foo="cd ~/" fish: Could not expand string '$tmp[2]' /usr/local/share/fish/functions/alias.fish (line 19): set body $tmp[2] ^ in function 'alias', called on standard input, with parameter list 'foo=cd ~/' Makes me wonder what else I'll have to relearn to use fish. Can someone tell me if it's worth the effort? Edit: didn't take me long to find something wors…

Howdy, author here.

fish doesn't have aliases, only functions. 'alias' is itself a function, which looks like it has a bug. I filed https://github.com/ridiculousfish/fishfish/issues/48 to track this.

(The usual way a fish user would add this function would be to put a file 'foo.fish' in ~/.config/fish/functions, or to use 'funced fish' to create one interactively.)

As for your infinite loop - fish certainly does not execute all functions when it sources the file. I wasn't able to reproduce your problem. Can you explain how you added this function?

Thanks!

Re: Fish: Finally, a command line shell for the 90s

#119
post #106

Earlier quoted context omitted.

You can also find `how' on the Arch-Linux Wiki ( https://wiki.archlinux.org/index.php/Fish#Configuration_Sugg... ). Also judging by your blog you might like something like PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \ "$(pwd) $(history 1)" >> ~/.bash_eternal_history' in your .bashrc, so that you don't have to abuse the bash-history for keeping a lifetime of commands around.

Is it abuse? It hasn't slowed anything down yet. Also, in the blog post I linked to the link you mention.

I don't know whether it's abuse. I just don't trust bash's history enough.

Yeah, I now noticed that you already put that link in the blog.

Re: Fish: Finally, a command line shell for the 90s

#120
post #14
post #3

I use fish ( http://fishshell.com/ ), and it's amazing. However, they're missing the most important feature from their front page: Syntax highlighting! Valid executables are colored green, as you type. Invalid commands are red, as you type. Valid files are underlined, as you type. Like the carpenter who can feels the feedback of the grain of the wood through the handle of his plane can adjust his technique as he plan…

zsh has a plugin for fish-style syntax highlighting: https://github.com/zsh-users/zsh-syntax-highlighting

~ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git Cloning into zsh-syntax-highlighting... warning: remote HEAD refers to nonexistent ref, unable to checkout.

:(

Post reply on HN