- end_with
- end_with.s
- has
- has.s
- has_not
- has_not.s
- if
- is_array
- is_array.s
- is_bash
- is_bash.s
- is_dir
- is_dir.s
- is_executable
- is_executable.s
- is_executable_file
- is_executable_file.s
- is_exported
- is_falsy
- is_falsy.s
- is_file
- is_file.s
- is_float
- is_float.s
- is_function
- is_function.s
- is_gnu_sed
- is_integer
- is_integer.s
- is_link
- is_link.s
- is_number
- is_number.s
- is_readable
- is_readable.s
- is_truthy
- is_truthy.s
- is_tty_available
- is_tty_available.s
- is_ubuntu
- is_undefined
- is_writable
- is_writable.s
- not.s
- not.s.p
- start_with
- start_with.s
- str_include
- str_include.s
- Usage:
l.end_with <string> <match>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/end_with.bats
- Source Code: src/modules/end_with.bash
- Usage:
l.end_with.s <string> <match>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Dependent:
end_with
- Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/end_with.s.bats
- Source Code: src/modules/end_with.s.bash
- Usage:
l.has <condition> <what>
- Description:
- Exit with 0 or 1. Check if command/function/alias/keyword/builtin or anything existed.
<condition>
Valid value:command
,function
,alias
,keyword
,builtin
,the
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/has.bats
- Source Code: src/modules/has.bash
- Usage:
l.has.s <condition> <what>
- Description:
- Echo
true
orfalse
to indicate that command/function/alias/keyword/builtin or anything existed. <condition>
Valid value:command
,function
,alias
,keyword
,builtin
,the
- Echo
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/has.s.bats
- Source Code: src/modules/has.s.bash
- Usage:
l.has_not <condition> <what>
- Description: Opposite to l.has
- Dependent:
has
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/has_not.bats
- Source Code: src/modules/has_not.bash
- Usage:
l.has_not.s <condition> <what>
- Description: Opposite to l.has.s
- Dependent:
has.s
not.s
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/has_not.s.bats
- Source Code: src/modules/has_not.s.bash
- Usage:
l.if <condition> <then> [<else>]
- Description:
- The difference from shell builtin
if
is when condition function throw exception it will ended immediately. <condition>
can be function name, string and number. The function should returntrue
/0
orfalse
/1
.<then>
and<else>
must be function name. And<else>
is optional.- When
<condition>
is true,<then>
function will be invoked. Otherwise<else>
will be invoked if it passed.
- The difference from shell builtin
- Since: 0.1.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/if.bats
- Source Code: src/modules/if.bash
- Usage:
l.is_array <var_name>
- Description: When the variable is array or associative array, it returns 0 (true). Otherwise it returns 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Notice:
- Only with bash 4.3, this function return 1 when the variable declared without initialization.
- Because
declare -p a
showsdeclare: a: not found
whendeclare -a a
. It's a bug in bash 4.3.
- Test Cases: tests/modules/is_array.bats
- Source Code: src/modules/is_array.bash
- Usage:
l.is_array.s <var_name>
- Description: When the variable is array or associative array, it prints
true
. Otherwise it printsfalse
. And it always exit with code 0. - Dependent:
is_array
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Notice:
- Only with bash 4.3, this function will echo
false
when the variable declared without initialization. - Because
declare -p a
showsdeclare: a: not found
whendeclare -a a
. It's a bug in bash 4.3.
- Only with bash 4.3, this function will echo
- Test Cases: tests/modules/is_array.s.bats
- Source Code: src/modules/is_array.s.bash
- Usage:
l.is_bash
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_bash.bats
- Source Code: src/modules/is_bash.bash
- Usage:
l.is_bash.s
- Description: This function always echo
true
orfalse
and exit code always be 0. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_bash.s.bats
- Source Code: src/modules/is_bash.s.bash
- Usage:
l.is_dir <path>
- Description:
- Detect
<path>
is whether a directory or not. - Return 0 (true) or 1 (false). This function should never throw exception error.
- Detect
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_dir.bats
- Source Code: src/modules/is_dir.bash
- Usage:
l.is_dir.s <path>
- Description:
- Detect
<path>
is whether a directory or not. - This function always echo
true
orfalse
and exit code always be 0.
- Detect
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_dir.s.bats
- Source Code: src/modules/is_dir.s.bash
- Usage:
l.is_executable <path>
- Description:
- Similar to
[[ -x ]]
. - Return 0 (true) or 1 (false). This function should never throw exception error.
- Similar to
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_executable.bats
- Source Code: src/modules/is_executable.bash
- Usage:
l.is_executable.s <path>
- Description:
- Similar to
[[ -x ]]
- This function always echo
true
orfalse
and exit code always be 0.
- Similar to
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_executable.s.bats
- Source Code: src/modules/is_executable.s.bash
- Usage:
l.is_executable_file <path>
- Description:
- Similar to
l.is_executable
. But if<path>
is directory it will return false. - Return 0 (true) or 1 (false). This function should never throw exception error.
- Similar to
- Dependent:
is_dir
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_executable_file.bats
- Source Code: src/modules/is_executable_file.bash
- Usage:
l.is_executable_file.s <path>
- Description:
- Similar to
l.is_executable
. But if<path>
is directory it will return false. - This function always echo
true
orfalse
and exit code always be 0.
- Similar to
- Dependent:
is_executable_file
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_executable_file.s.bats
- Source Code: src/modules/is_executable_file.s.bash
- Usage:
l.is_exported <var_name>
- Description:
- Check whether a shell variable is exported.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_exported.bats
- Source Code: src/modules/is_exported.bash
- Usage:
l.is_falsy <var>
- Description:
- nonzero number and string "false" should be falsy.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Dependent:
is_integer
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_falsy.bats
- Source Code: src/modules/is_falsy.bash
- Usage:
l.is_falsy.s <var>
- Description:
- nonzero number and string "false" should be falsy.
- This function always echo
true
orfalse
and exit code always be 0.
- Dependent:
is_falsy
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_falsy.s.bats
- Source Code: src/modules/is_falsy.s.bash
- Usage:
l.is_file <path>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_file.bats
- Source Code: src/modules/is_file.bash
- Usage:
l.is_file.s <path>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_file.s.bats
- Source Code: src/modules/is_file.s.bash
- Usage:
l.is_float <str>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_float.bats
- Source Code: src/modules/is_float.bash
- Usage:
l.is_float.s <str>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Dependent:
is_float
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_float.s.bats
- Source Code: src/modules/is_float.s.bash
- Usage:
l.is_function <var_name>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_function.bats
- Source Code: src/modules/is_function.bash
- Usage:
l.is_function.s <var_name>
- Description:
- Detect
<var_name>
is whether a function or not. - This function always echo
true
orfalse
and exit code always be 0.
- Detect
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_function.s.bats
- Source Code: src/modules/is_function.s.bash
- Usage:
l.is_gnu_sed
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_gnu_sed.bats
- Source Code: src/modules/is_gnu_sed.bash
- Usage:
l.is_integer <str>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_integer.bats
- Source Code: src/modules/is_integer.bash
- Usage:
l.is_integer.s <str>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Dependent:
is_integer
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_integer.s.bats
- Source Code: src/modules/is_integer.s.bash
- Usage:
l.is_link <path>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_link.bats
- Source Code: src/modules/is_link.bash
- Usage:
l.is_link.s <path>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_link.s.bats
- Source Code: src/modules/is_link.s.bash
- Usage:
l.is_number <str>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_number.bats
- Source Code: src/modules/is_number.bash
- Usage:
l.is_number.s <str>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Dependent:
is_number
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_number.s.bats
- Source Code: src/modules/is_number.s.bash
- Usage:
l.is_readable <path>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_readable.bats
- Source Code: src/modules/is_readable.bash
- Usage:
l.is_readable.s <path>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_readable.s.bats
- Source Code: src/modules/is_readable.s.bash
- Usage:
l.is_truthy <str>
- Description:
- zero number and string "true" should be truthy.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_truthy.bats
- Source Code: src/modules/is_truthy.bash
- Usage:
l.is_truthy.s <str>
- Description:
- zero number and string "true" should be truthy.
- This function always echo
true
orfalse
and exit code always be 0.
- Dependent:
is_truthy
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_truthy.s.bats
- Source Code: src/modules/is_truthy.s.bash
- Usage:
l.is_tty_available
- Description: Whether /dev/tty is available
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_tty_available.bats
- Source Code: src/modules/is_tty_available.bash
- Usage:
l.is_tty_available.s
- Description:
- Whether /dev/tty is available
- This function always echo
true
orfalse
and exit code always be 0.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_tty_available.s.bats
- Source Code: src/modules/is_tty_available.s.bash
- Usage:
l.is_ubuntu
- Description:
- Detect whether current os is Ubuntu or not.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_ubuntu.bats
- Source Code: src/modules/is_ubuntu.bash
- Usage:
l.is_undefined <var_name>
- Description:
- Check whether a shell variable is undefined.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.5.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_undefined.bats
- Source Code: src/modules/is_undefined.bash
- Usage:
l.is_writable <path>
- Description: Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_writable.bats
- Source Code: src/modules/is_writable.bash
- Usage:
l.is_writable.s <path>
- Description: This function always echo
true
orfalse
and exit code always be 0. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/is_writable.s.bats
- Source Code: src/modules/is_writable.s.bash
- Usage:
l.not.s <condition>
- Description:
<condition>
must betrue
orfalse
. This function returns the opposite value. - Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/not.s.bats
- Source Code: src/modules/not.s.bash
- Usage:
echo <condition> | l.not.s.p
- Description: The pipeline version of l.not
- Dependent:
not.s
- Since: 0.3.0
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/not.s.p.bats
- Source Code: src/modules/not.s.p.bash
- Usage:
l.start_with <string> <match>
- Description:
- Check if a string starts with given match string.
- Return 0 (true) or 1 (false). This function should never throw exception error.
- Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/start_with.bats
- Source Code: src/modules/start_with.bash
- Usage:
l.start_with.s <string> <match>
- Description:
- Check if a string starts with given match string.
- This function always echo
true
orfalse
and exit code always be 0.
- Dependent:
start_with
- Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/start_with.s.bats
- Source Code: src/modules/start_with.s.bash
- Usage:
l.str_include <string> <sub-string>
- Description: Return
true
orfalse
. Check if a string includes given match string. - Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/str_include.bats
- Source Code: src/modules/str_include.bash
- Usage:
l.str_include.s <string> <sub-string>
- Description: Return
true
orfalse
. Check if a string includes given match string. - Dependent:
str_include
- Since: 0.3.1
- Bash: 4.0+
- Status: tested
- Test Cases: tests/modules/str_include.s.bats
- Source Code: src/modules/str_include.s.bash