The following macros take their arguments as they are, without enclosing them into double or single quotes, as follows:
test $1 '=' $2
so we must take care of quoting the arguments appropriately.
Return successfully if the arguments are equal when compared when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello mbfl_string_eq('ciao', 'ciao') ⇒ 0 mbfl_string_eq('ciao', 'hello') ⇒ 1 mbfl_string_eq("$CIAO", "$CIAO") ⇒ 0 mbfl_string_eq("$CIAO", "$HELLO") ⇒ 1
Return successfully if the arguments are different when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello mbfl_string_neq('ciao', 'ciao') ⇒ 1 mbfl_string_neq('ciao', 'hello') ⇒ 0 mbfl_string_neq("$CIAO", "$CIAO") ⇒ 1 mbfl_string_neq("$CIAO", "$HELLO") ⇒ 0
Return successfully if STR1 is less than STR2 when compared when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello SALUT=salut mbfl_string_lt('ciao', 'ciao') ⇒ 1 mbfl_string_lt('ciao', 'hello') ⇒ 0 mbfl_string_lt('salut', 'hello') ⇒ 0 mbfl_string_lt("$CIAO", "$CIAO") ⇒ 1 mbfl_string_lt("$CIAO", "$HELLO") ⇒ 0 mbfl_string_lt("$SALUT", "$HELLO") ⇒ 1
Return successfully if STR1 is greater than STR2 when compared when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello SALUT=salut mbfl_string_gt('ciao', 'ciao') ⇒ 1 mbfl_string_gt('ciao', 'hello') ⇒ 1 mbfl_string_gt('salut', 'hello') ⇒ 0 mbfl_string_gt("$CIAO", "$CIAO") ⇒ 1 mbfl_string_gt("$CIAO", "$HELLO") ⇒ 1 mbfl_string_gt("$SALUT", "$HELLO") ⇒ 0
Return successfully if STR1 is less than or equal to STR2 when compared when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello SALUT=salut mbfl_string_le('ciao', 'ciao') ⇒ 0 mbfl_string_le('ciao', 'hello') ⇒ 0 mbfl_string_le('salut', 'hello') ⇒ 0 mbfl_string_le("$CIAO", "$CIAO") ⇒ 0 mbfl_string_le("$CIAO", "$HELLO") ⇒ 0 mbfl_string_le("$SALUT", "$HELLO") ⇒ 1
Return successfully if STR1 is greater than or equal to STR2 when compared when compared lexicographically as strings; otherwise return failure.
declare CIAO=ciao HELLO=hello SALUT=salut mbfl_string_ge('ciao', 'ciao') ⇒ 0 mbfl_string_ge('ciao', 'hello') ⇒ 1 mbfl_string_ge('salut', 'hello') ⇒ 0 mbfl_string_ge("$CIAO", "$CIAO") ⇒ 0 mbfl_string_ge("$CIAO", "$HELLO") ⇒ 1 mbfl_string_ge("$SALUT", "$HELLO") ⇒ 0
Return successfully if the argument STR is equal to, respectively: ‘yes’, ‘no’, ‘true’, ‘false’ when compared when compared lexicographically as string; otherwise return failure.
declare YES=yes NO=no TRUE=true FALSE=false mbfl_string_eq_yes('yes') ⇒ 0 mbfl_string_eq_yes("$YES") ⇒ 0 mbfl_string_eq_yes('no') ⇒ 1 mbfl_string_eq_yes("$NO") ⇒ 1 mbfl_string_eq_no('yes') ⇒ 1 mbfl_string_eq_no("$YES") ⇒ 1 mbfl_string_eq_no('no') ⇒ 0 mbfl_string_eq_no("$NO") ⇒ 0 mbfl_string_eq_true('true') ⇒ 0 mbfl_string_eq_true("$TRUE") ⇒ 0 mbfl_string_eq_true('false') ⇒ 1 mbfl_string_eq_true("$FALSE") ⇒ 1 mbfl_string_eq_false('true') ⇒ 1 mbfl_string_eq_false("$TRUE") ⇒ 1 mbfl_string_eq_false('false') ⇒ 0 mbfl_string_eq_false("$FALSE") ⇒ 0
Return successfully if the argument STR is not equal to, respectively: ‘yes’, ‘no’, ‘true’, ‘false’ when compared when compared lexicographically as string; otherwise return failure.
declare YES=yes NO=no TRUE=true FALSE=false mbfl_string_neq_yes('yes') ⇒ 1 mbfl_string_neq_yes("$YES") ⇒ 1 mbfl_string_neq_yes('no') ⇒ 0 mbfl_string_neq_yes("$NO") ⇒ 0 mbfl_string_neq_no('yes') ⇒ 0 mbfl_string_neq_no("$YES") ⇒ 0 mbfl_string_neq_no('no') ⇒ 1 mbfl_string_neq_no("$NO") ⇒ 1 mbfl_string_neq_true('true') ⇒ 1 mbfl_string_neq_true("$TRUE") ⇒ 1 mbfl_string_neq_true('false') ⇒ 0 mbfl_string_neq_true("$FALSE") ⇒ 0 mbfl_string_neq_false('true') ⇒ 0 mbfl_string_neq_false("$TRUE") ⇒ 0 mbfl_string_neq_false('false') ⇒ 1 mbfl_string_neq_false("$FALSE") ⇒ 1
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.