Tag Info

Hot answers tagged

27

I have used zsh and fish. Both offer many more user-friendly features than bash. And, I know that zsh advertises itself as a shell, versus a scripting language. And, I have to agree completely. If I'm going to write a script, I always use bash. However, for my CLI, I prefer fish. While zsh is pretty, fish, is phenomenal! I do agree with some of the ...


17

This article explains a lot of fish's advantages over bash and zsh. Fish has one great weakness though - even if it has great features, it has next to no user base or community around it. The development is not that active either - the last version is over a year old. In my personal experience zsh offers everything that fish has offer(after some ...


16

Fish doesn't have a special syntax for a logical AND (&&) or a logical OR (||). Instead, you can use the commands and and or, which verify the previous command's exit status and act accordingly: command1 and command2 command1 or command2 Furthermore – just like in bash – you can use a semicolon ; to execute two commands one after the other: ...


13

@endolith: Yes, it only seems to affect fish. I had the same problem, the issue is caused by the sudo option "tty_tickets". Disabling this on your /etc/sudores will solve the problem. The following will disable tty_tickets: Defaults env_reset,!tty_tickets


11

Here's how I managed to compile fish in Cygwin. Step 1: Check that all dependencies are installed First, make sure we have the following cygwin packages: libncurses-devel libiconv autoconf (not a really a dependency of fish, but we need it for a later step) Step 2: Download and extract the latest source Next, download the latest source from ...


7

Did you remember to mark $GOPATH in fish as exported? set -x GOPATH /home/<me>/workspace/go-workspace It's not sufficient to test with echo $GOPATH since that will work regardless of whether the variable is exported. Check with bash -c 'echo $GOPATH' which will only print the value of GOPATH if it has been exported. In bash, you export ...


5

I've never used fish myself but a cursory google search brought up this page which states that Powerful History Mechanism Modern shells save previous commands in a command history. You can view earlier commands by using the up and down arrows. Fish extends this concept by integrating the history search functionality. To search the history, simply ...


5

So when I run ./install.sh it should be processed by bash, right? Indeed. That's exactly what the shebang is for. Troubleshooting Save the following as test.sh and try to run it from fish. #!/bin/bash true && true It works on my computer, and it should on yours. Check if the first line of install.sh contains only the characters ...


5

If nothing else works, try sudo -i (by itself). That'll give you a root shell after one password.


5

I had to be dragged kicking and screaming to use zsh at a previous job after many years of bash. But when I saw the features available in zsh and the compatibility with bash I was hooked. Now I've had to revert to bash and I miss many of the advanced features of zsh. I'd head towards zsh for the following reasons: As Bozhidar pointed out, pick a shell ...


4

I dont think syntax highlighting should happen at the shell level but at the interface level (just my opinion -and someone else's it seems-), so I would look into "plugins" for Terminal or your favorite console, for example this plug in for Kate might help, or this other one which offers syntax highlighting in nano Here is still more talk about how to ...


4

It looks like you want: set -xg PATH /opt/local/bin /opt/local/sbin $PATH Edit: I see what you mean, this syntax takes some getting used to. It wants spaces instead of colons, and it can't be in quotes, and all the paths in your current PATH must actually exist (in my case, I had /usr/local/sbin in my PATH even though it didn't actually exist, and that ...


4

solution: choose if you want a system wide setting or an user config and edit the appropriate configuration file, don't use path_helper with fish. more fish doesn't source /etc/profile, for system wide and user config it'll read /etc/fish/config.fish and ~/.config/fish/config.fish respectively [1]. path_helper is meant for using for shells that source a ...


3

Below is what I have in ~/.config/fish/config.fish for your specific example. set -gx HOSTNAME (hostname) if status --is-interactive; keychain --nogui --clear ~/.ssh/id_rsa [ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish end The source command is ., which also works in bash.


3

Thanks to Aaron for responding and for all those who answered other similar questions on the stackexchange sites. For posterity's sake, here is what I figured out: path_helper is called from /etc/profile, by the syntax eval '/usr/libexec/path_helper -s' (where the apostrophes are actually backticks). Like a dummy, I didn't know how backticks worked, and so ...


3

From the documentation: The and builtin is used to execute a command if the current exit status (as set by the last previous command) is 0. COMMAND1; and COMMAND2 So you'd call: make; and make install


3

fish shell 2.1.0 is now officially supported in Cygwin, it's possible to install it using the default installer.


3

My current solution (see here for a maybe more recent version): egrep "^export " ~/.profile | while read e set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/") set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/") # remove surrounding quotes if existing set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/") if test $var = ...


3

In fish, $ is used only for variable expansion. Omit the $ from the command and you should be good. Say: ls -l (which vim) You might also want to refer to the documentation: Command Substitutions


2

Alt-Up arrow gives you the last argument from the previous command. Subsequent pushes cycle throught prior arguments. I haven't found a satisfactory equivalent to !!, except Up then Ctrl-A


2

Sammyg was correct that set_color is what you're looking for. The trick is that a single call to set_color doesn't color a specified block of text, but sets the color that all subsequent text will be printed. The -b flag sets the background color. Here's a simple function which will give you a similar effect to that zsh prompt (put it in your fish/functions ...


2

I installed fish (1.23.1) to investigate this. It turns out that fish only updates the title if $TERM is one of the following: xterm, screen, nxterm, rxvt. Otherwise, it never calls the fish_title function. Terminal's default value is xterm-256color and prior to Mac OS X Lion 10.7 it was xterm-color, neither of which is recognized by fish. Fish is simply ...


2

Doesn't fully answer your questions but probably a bit more than just a comment: Based on other comments in your answer, I think the error you saw is fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. That occurs because you're conducting these tests on a brand new git repository, one that has no committed work. Not only is ...


2

I have absolutely no idea about /etc/paths.d, path_helper, &c., all of which seem like excessive complications to me, but the following at the end of your ~/.bashrc should put you right: PATH=/usr/local/bin:$PATH Hope this helps!


2

@Yaakov's proposal is actually quite close, but to compile fish 2.0 successfully you would need to comment/remove offending line from fallback.h and invoke configuration with: ./configure CXXFLAGS='-I/usr/include -I/usr/include/ncursesw' after which you should be able to make and make install


1

fish uses $_ for the currently running program: http://fishshell.com/docs/current/index.html#title To get the last arg of the last command, use Alt+Up


1

sudo !! (or sudo bang bang) is one of my most oft used commands. I'm still using just plain old bash that has it just fine. Sorry to hear that fish doesn't implement it correctly. A little googling and I found this: function sudo if test "$argv" = !! eval command sudo $history[1] else command sudo $argv end end There are a lot ...


1

I see this in my rsync man page: DIAGNOSTICS rsync occasionally produces error messages that may seem a little cryptic. The one that seems to cause the most confusion is "protocol version mismatch -- is your shell clean?". This message is usually caused by your startup scripts or remote shell facility producing unwanted garbage on ...


1

fish doesn't implement incremental history search, although it seems to come up fromtime to time. The pre-2.0 documentation has a "Missing features and bugs" section 1 which lists incremental history search fairly far down in the "Possible features" list. The fish-users mailing list includes this message from Axel Liljencratz, dated August 21, 2006, in which ...


1

Although you can not bind keys on itself in GNU Readline — something like "(": "()" drives to endless loop — there is a way. Not for readline in general, only for bash. Add this to you .bashrc: readline-brackets() { READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${1}${READLINE_LINE:$READLINE_POINT}" ((READLINE_POINT+=1)) } bind -m vi-insert -x ...



Only top voted, non community-wiki answers of a minimum length are eligible