Unix- IF condition issue

2014-07-26T19:06:53

I'm having a problem in if condition usage under Unix. Need your help in sorting it out.

if (a=1 and b is not null) or a=0 and b is null
echo "sucess"
else 
echo failure

I tried the below code but I am getting an error.

if [[ ${a} -eq 1 ] && [[ ! -z ${b} ]]] || [[ ${a} -eq 0 ] && [[ -z ${b} ]]]; then
    echo "sucess"
else 
    echo "Failure"
fi

Can anyone suggest a solution?

Copyright License:
Author:「user3847566」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/24970358/unix-if-condition-issue

About “Unix- IF condition issue” questions

I'm having a problem in if condition usage under Unix. Need your help in sorting it out. if (a=1 and b is not null) or a=0 and b is null echo "sucess" else echo failure I tried the below code bu...
I have a simple IF-ELSE formula set in excel which somehow not giving me the desired result. I am putting an if-else condition in one of the columns which should result in me the value of other col...
I have issue with if else condition in jqgrid column. I am passing true in the if condition (i.e editaccess == true), but sometimes it is going into if and sometime it going into else. JS: {
I have issue with if else condition in jqgrid column. I am passing true in the if condition (i.e editaccess == true), but sometimes it is going into if and sometime it going into else. JS: {
I am developing MVC app. In controller, I have written simple code. string LastDesignation = approval.GetDesig(oPA.CreatedById); string CurDesignation = loggedEmployee.DType.ToString(); if (
I ran into this issue when exploring uses of the Condition class in AssertJ 3.5.2 on Java 8. I can create a Condition instance for a generically-typed List, but I get error messages in Eclipse whe...
In the .vscode/settings.json of my current workspace, I have: "python.terminal.activateEnvironment": true It works upon opening an integrated PowerShell terminal, but both MINGW64 bash a...
Can you explain why when I have an in condition the result is not returned in the same order as they are written? I am trying to extract the column name from all_tab_columns and I want them to be
I creating new workflow and I need to assign issues by condition. For example: During create issue if in the dropdown list I select "language_1" issue will be assigned to "translator_1" or if I s...
I have this query here: SELECT formas.*, SMS_SERVISI.IDTICKET, SMS_SERVISI.MBYLLUR,SMS_SERVISI.time_added FROM formas LEFT JOIN SMS_SERVISI ON formas.ID = SMS_SERVISI.IDTICKET WHERE SMS_SERVISI.

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.