[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Conditional operator in Shell Arithmetic section

From: uzibalqa
Subject: Conditional operator in Shell Arithmetic section
Date: Sat, 18 Mar 2023 17:59:59 +0000

Have been reading the manual about the arithmetic conditional operation 
described by 

expr ? expr : exp

This is quite difficult to understand exactly how to use it.

For instance, consider setting the variable opst to 0 when the length of delim 
in positive in a bash script.  One would use 

opst=$(( ${#delim} > 0 ? 0 : 1 ))

There needs to be at least one example of actual use in a typical situation.  I 
also suggest to include it in section " Conditional Constructs".

Specifying conditional operator "expr ? expr : exp"  simply as Shell Arithmetic 
makes it very difficult to find in the manual.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]