chain Fish commands via `&&` or `||`
In Bash/ZSH and other shells, I am used to using &&
and ||
.
Is there any equivalent in Fish?
shell fish
add a comment |
In Bash/ZSH and other shells, I am used to using &&
and ||
.
Is there any equivalent in Fish?
shell fish
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31
add a comment |
In Bash/ZSH and other shells, I am used to using &&
and ||
.
Is there any equivalent in Fish?
shell fish
In Bash/ZSH and other shells, I am used to using &&
and ||
.
Is there any equivalent in Fish?
shell fish
shell fish
asked Jul 10 '12 at 3:01
AlbertAlbert
2,83463043
2,83463043
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31
add a comment |
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31
add a comment |
2 Answers
2
active
oldest
votes
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
- fish now supports
&&
(likeand
),||
(likeor
), and!
(likenot
), for better migration from POSIX-compliant shells (#4620).
add a comment |
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:
command1 ; command2
This allows using a more familiar syntax:
command1 ;and command2
command1 ;or command2
See http://fishshell.com/docs/current/tutorial.html#tut_combiners
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
This allows using a more familiar syntax:
is very subjective
– Petr Peller
Jun 2 '16 at 10:46
1
;and
is less readable than&&
as the semicolon suggests a logically disjoint operation. It's visually jarring.
– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f446930%2fchain-fish-commands-via-or%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
- fish now supports
&&
(likeand
),||
(likeor
), and!
(likenot
), for better migration from POSIX-compliant shells (#4620).
add a comment |
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
- fish now supports
&&
(likeand
),||
(likeor
), and!
(likenot
), for better migration from POSIX-compliant shells (#4620).
add a comment |
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
- fish now supports
&&
(likeand
),||
(likeor
), and!
(likenot
), for better migration from POSIX-compliant shells (#4620).
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
- fish now supports
&&
(likeand
),||
(likeor
), and!
(likenot
), for better migration from POSIX-compliant shells (#4620).
answered Jan 1 at 23:18
DennisDennis
272412
272412
add a comment |
add a comment |
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:
command1 ; command2
This allows using a more familiar syntax:
command1 ;and command2
command1 ;or command2
See http://fishshell.com/docs/current/tutorial.html#tut_combiners
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
This allows using a more familiar syntax:
is very subjective
– Petr Peller
Jun 2 '16 at 10:46
1
;and
is less readable than&&
as the semicolon suggests a logically disjoint operation. It's visually jarring.
– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
|
show 1 more comment
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:
command1 ; command2
This allows using a more familiar syntax:
command1 ;and command2
command1 ;or command2
See http://fishshell.com/docs/current/tutorial.html#tut_combiners
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
This allows using a more familiar syntax:
is very subjective
– Petr Peller
Jun 2 '16 at 10:46
1
;and
is less readable than&&
as the semicolon suggests a logically disjoint operation. It's visually jarring.
– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
|
show 1 more comment
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:
command1 ; command2
This allows using a more familiar syntax:
command1 ;and command2
command1 ;or command2
See http://fishshell.com/docs/current/tutorial.html#tut_combiners
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:
command1 ; command2
This allows using a more familiar syntax:
command1 ;and command2
command1 ;or command2
See http://fishshell.com/docs/current/tutorial.html#tut_combiners
edited Oct 12 '14 at 5:31
lindhe
140214
140214
answered Jul 10 '12 at 3:18
DennisDennis
40.5k6101136
40.5k6101136
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
This allows using a more familiar syntax:
is very subjective
– Petr Peller
Jun 2 '16 at 10:46
1
;and
is less readable than&&
as the semicolon suggests a logically disjoint operation. It's visually jarring.
– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
|
show 1 more comment
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
This allows using a more familiar syntax:
is very subjective
– Petr Peller
Jun 2 '16 at 10:46
1
;and
is less readable than&&
as the semicolon suggests a logically disjoint operation. It's visually jarring.
– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
4
4
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
There's an open github issue to add support for this syntax: && doesn't work · Issue #150 · fish-shell/fish-shell
– aboy021
Feb 26 '16 at 0:41
20
20
This allows using a more familiar syntax:
is very subjective– Petr Peller
Jun 2 '16 at 10:46
This allows using a more familiar syntax:
is very subjective– Petr Peller
Jun 2 '16 at 10:46
1
1
;and
is less readable than &&
as the semicolon suggests a logically disjoint operation. It's visually jarring.– Clever Little Monkey
Jul 30 '17 at 20:08
;and
is less readable than &&
as the semicolon suggests a logically disjoint operation. It's visually jarring.– Clever Little Monkey
Jul 30 '17 at 20:08
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
@Elliott I agree, but Fish doesn't give you a choice.
– Dennis
Jul 30 '17 at 20:11
1
1
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
do note though that in fish and bourne shells, AND and OR operators have the same order, unlike C based languages: unix.stackexchange.com/a/88851/50703
– balupton
Jan 11 '18 at 8:31
|
show 1 more comment
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f446930%2fchain-fish-commands-via-or%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This syntax now supported on the master branch and will be released in Fish 3.0 (github.com/fish-shell/fish-shell/commit/…)
– Clever Little Monkey
Mar 29 '18 at 1:31