What does -o mean in an “if”? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionwhat does the -z flag mean hereWhat does || mean in bash?What does $'r' mean?What does `[ EXPRESSION ], [ ] and [OPTION` mean in `man test`?What does “< /dev/null” mean?What does “test $2 &&” mean in this bash script?What does “while :;” mean?What does this `-n` mean? [BASH]What does the backtick before/after dollar sign mean?Bash: What does “masking return values” mean?
Where are Serre’s lectures at Collège de France to be found?
Why wasn't DOSKEY integrated with COMMAND.COM?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Can an alien society believe that their star system is the universe?
How can I use the Python library networkx from Mathematica?
Can a party unilaterally change candidates in preparation for a General election?
How to Make a Beautiful Stacked 3D Plot
Quick way to create a symlink?
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
Compare a given version number in the form major.minor.build.patch and see if one is less than the other
First console to have temporary backward compatibility
Is there a kind of relay only consumes power when switching?
Is it common practice to audition new musicians 1-2-1 before rehearsing with the entire band?
What is the meaning of the simile “quick as silk”?
For a new assistant professor in CS, how to build/manage a publication pipeline
Can melee weapons be used to deliver Contact Poisons?
How come Sam didn't become Lord of Horn Hill?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
How do pianists reach extremely loud dynamics?
What is the escape velocity of a neutron particle (not neutron star)
When coming out of haste, do attackers have advantage on you?
Around usage results
Is the Standard Deduction better than Itemized when both are the same amount?
What does -o mean in an “if”?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionwhat does the -z flag mean hereWhat does || mean in bash?What does $'r' mean?What does `[ EXPRESSION ], [ ] and [OPTION` mean in `man test`?What does “< /dev/null” mean?What does “test $2 &&” mean in this bash script?What does “while :;” mean?What does this `-n` mean? [BASH]What does the backtick before/after dollar sign mean?Bash: What does “masking return values” mean?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
What is -o after -eq in the mentioned code:
...[ $sorszam -eq 0 ] && min1=$ertek; [ $sorszam -eq 1 -o $sorszam -eq 2 -o $sorszam -eq 3 ] && [ $ertek -lt $min1 ] && min1=$ertek...
bash test
add a comment |
What is -o after -eq in the mentioned code:
...[ $sorszam -eq 0 ] && min1=$ertek; [ $sorszam -eq 1 -o $sorszam -eq 2 -o $sorszam -eq 3 ] && [ $ertek -lt $min1 ] && min1=$ertek...
bash test
Note that-ois considered obsolete, and the correct way to write new code would be to use[ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ]instead.
– chepner
May 18 '17 at 18:18
add a comment |
What is -o after -eq in the mentioned code:
...[ $sorszam -eq 0 ] && min1=$ertek; [ $sorszam -eq 1 -o $sorszam -eq 2 -o $sorszam -eq 3 ] && [ $ertek -lt $min1 ] && min1=$ertek...
bash test
What is -o after -eq in the mentioned code:
...[ $sorszam -eq 0 ] && min1=$ertek; [ $sorszam -eq 1 -o $sorszam -eq 2 -o $sorszam -eq 3 ] && [ $ertek -lt $min1 ] && min1=$ertek...
bash test
bash test
edited Apr 13 at 15:01
Rui F Ribeiro
42.1k1484142
42.1k1484142
asked May 18 '17 at 14:26
Huntyr94Huntyr94
613
613
Note that-ois considered obsolete, and the correct way to write new code would be to use[ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ]instead.
– chepner
May 18 '17 at 18:18
add a comment |
Note that-ois considered obsolete, and the correct way to write new code would be to use[ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ]instead.
– chepner
May 18 '17 at 18:18
Note that
-o is considered obsolete, and the correct way to write new code would be to use [ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ] instead.– chepner
May 18 '17 at 18:18
Note that
-o is considered obsolete, and the correct way to write new code would be to use [ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ] instead.– chepner
May 18 '17 at 18:18
add a comment |
3 Answers
3
active
oldest
votes
As you can see in the Linux Documentation Project page about if, -o stands for the logical operator OR. In your case, the variable sorszam is checked whether it equals to 1, 2, or 3.
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
add a comment |
As you should know [ is an equivalent to test built-in command.
$ help [
[: [ arg... ]
This is a synonym for the "test" builtin...
so you should have a look at help test | grep -- "-o ":
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
add a comment |
-eq is an arithmetic binary operator that returns true if both numbers are equal.
-o is an or, you can can string it together with -eq to do multiple comparisons in one line.
Source
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f365858%2fwhat-does-o-mean-in-an-if%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As you can see in the Linux Documentation Project page about if, -o stands for the logical operator OR. In your case, the variable sorszam is checked whether it equals to 1, 2, or 3.
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
add a comment |
As you can see in the Linux Documentation Project page about if, -o stands for the logical operator OR. In your case, the variable sorszam is checked whether it equals to 1, 2, or 3.
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
add a comment |
As you can see in the Linux Documentation Project page about if, -o stands for the logical operator OR. In your case, the variable sorszam is checked whether it equals to 1, 2, or 3.
As you can see in the Linux Documentation Project page about if, -o stands for the logical operator OR. In your case, the variable sorszam is checked whether it equals to 1, 2, or 3.
answered May 18 '17 at 14:34
nikolasnikolas
310110
310110
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
add a comment |
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
1
1
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
Ah, so it is just an "or". Thanks the documentation, didn't know there was such thing.
– Huntyr94
May 21 '17 at 16:46
add a comment |
As you should know [ is an equivalent to test built-in command.
$ help [
[: [ arg... ]
This is a synonym for the "test" builtin...
so you should have a look at help test | grep -- "-o ":
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
add a comment |
As you should know [ is an equivalent to test built-in command.
$ help [
[: [ arg... ]
This is a synonym for the "test" builtin...
so you should have a look at help test | grep -- "-o ":
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
add a comment |
As you should know [ is an equivalent to test built-in command.
$ help [
[: [ arg... ]
This is a synonym for the "test" builtin...
so you should have a look at help test | grep -- "-o ":
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
As you should know [ is an equivalent to test built-in command.
$ help [
[: [ arg... ]
This is a synonym for the "test" builtin...
so you should have a look at help test | grep -- "-o ":
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
answered May 18 '17 at 14:44
RavexinaRavexina
1,4531823
1,4531823
add a comment |
add a comment |
-eq is an arithmetic binary operator that returns true if both numbers are equal.
-o is an or, you can can string it together with -eq to do multiple comparisons in one line.
Source
add a comment |
-eq is an arithmetic binary operator that returns true if both numbers are equal.
-o is an or, you can can string it together with -eq to do multiple comparisons in one line.
Source
add a comment |
-eq is an arithmetic binary operator that returns true if both numbers are equal.
-o is an or, you can can string it together with -eq to do multiple comparisons in one line.
Source
-eq is an arithmetic binary operator that returns true if both numbers are equal.
-o is an or, you can can string it together with -eq to do multiple comparisons in one line.
Source
answered May 18 '17 at 14:36
cutrightjmcutrightjm
2,26621325
2,26621325
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f365858%2fwhat-does-o-mean-in-an-if%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
Note that
-ois considered obsolete, and the correct way to write new code would be to use[ "$sorszam" -eq 1 ] || [ "$sorszam" -eq 2 ] || [ "$sorszam" -eq 3 ]instead.– chepner
May 18 '17 at 18:18