New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for && and || #4620
Comments
Thank you for doing your homework on fish design before suggesting this. This was suggested in #150, but that issue is "locked and limited to collaborators", which is the equivalent of keeping our ears shut. Firstly, I think it's fair to ask how much the argument of "less syntax" holds true anymore after the fix for #1583 – this is not just syntactic sugar, but command-grouping syntax. When
Basically, fish lacks a Secondly, I think this is one of the costlier incompatibilities. For one thing: ssh-copy-id (#2292). Another (personal annoyance) is Gerrit; its "cherry-pick" button puts a command like That said, for those coming here wanting full POSIX compatibility: Sweet dreams. POSIX incompatibility (aka. not having to quote variables) is reason alone to use fish. |
I am not a fish collaborator and I like the current design; I like how everything in fish is done with commands and how the “or” and “and” commands (not operators) do something based on the status of the previous command. The semicolon is just a way of stringing commands together.
…---
R. Mark Volkmann
Object Computing, Inc.
On Dec 24, 2017, at 9:58 PM, anordal ***@***.***> wrote:
Thank you for doing your homework on fish design before suggesting this.
This was suggested in #150, but that issue is "locked and limited to collaborators", which is the equivalent of keeping our ears shut.
Firstly, I think it's fair to ask how much the argument of "less syntax" holds true anymore after the fix for #1583 – this is not just syntactic sugar, but command-grouping syntax. When and and or were pure commands, this was a meaningless construct (and a schrödingbug):
if true; and false
echo '↑ Where does the condition stop and the if-body begin?'
end
To kill this gotcha, the meaningless construct was assigned the right meaning by changing the parser. Notice that it would also be solved by command-grouping syntax like &&/||. Or a then keyword to if/while of course.
Secondly, I think this is one of the costlier incompatibilities. For one thing: ssh-copy-id (#2292). Another (personal annoyance) is Gerrit; its "cherry-pick" button puts a command like git fetch && git checkout <sha1> into your clipboard…
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sorry for the repeat! I tried searching for One of my favorite sections of the Fish design document states:
From my perspective as a user, I'm thinking about this more in terms of what makes sense to me, and not what makes works for the parser. I realize there are practical considerations that need to be taken into account, so this might be a nieve view. I think this issue for me is more the semicolon in the middle and less using symbols vs. words. The semicolon feels like an unexpected addition that's there to satisfy the fish compiler. Would it be possible to drop it? To me, the second example is how I would expect the syntax to work:
As a side note, I'm totally fine with the idea of closing this issue if you guys have already considered it and want to move on. My suggestion is simply me quibbling over a small thing in an otherwise great language. I'd also never dream of requesting full POSIX compatibility. Dropping POSIX support drastically simplifies the language, which is my favorite feature of fish. Merry Christmas! |
I've been a fish user for over a year now (I think!). I really enjoy user-friendliness of the shell on a daily basis (especially auto-suggestions) but when it comes to executing and running one liners too often I find annoyances like missing PS. Another thing which I would sell my soul for is easy support of one liners like: |
@Rush Because of the |
Not sure about you but I mostly use shell for one liners. Longer scripts I
prefer to write in node.js, Ruby or Perl. With all due respect, your string join example is not
usable for a one liner for loop.
|
you can add this partial functionality, I've added my own findings on this in the wiki, you can check that out here: https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-(!!-and-!$) |
@ridiculousfish Thank you! |
This is so awesome, thanks! |
@davidawad - your link no longer brings anything up, just an empty wiki page. |
@thiagodemellobueno: It got renamed since then - the link is https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C). |
@Rush why not use |
@nafg in some cases yes, but not if you want an absolute path to absolute path
|
While this works nicely when typing out commands it doesn't work when copy-pasting, which has caused problems for me in some cases. Isn't there a way to simply make fish parse |
@Linusnie: Wait for 3.0. |
Further conversation here isn't constructive. |
Thanks for creating such an awesome shell! I've been enjoying using it, especially when scripting.
I'm using Fish 2.7.0 on macOS 10.13.2 inside of a custom tmux terminal profile.
I'd like to request you guys add support for the
&&
and||
operators. I know fish supportsand
andor
, but using them feels a bit awkward, especially with the required semicolon.Going off of the Fish Design Document:
;
also requires the user to understand thatand
is a command, which adds a bit of cognitive load.&&
in a command, Fish prints out an error message telling me what I should have usedand
instead. However, I wish would just do what I wanted instead. This feels like when I typebrew update <app>
, and it tells me I should have typed inbrew upgrade <app>
.I realize this is a small thing, but it's something I've missed from zsh.
The text was updated successfully, but these errors were encountered: