Skip to main content
Skip to main content

is

Source code

This file contains functions for checking types

Index​

is::array​

bash rust

Check if a variable is an array

Example​

local -a arr=("a" "b" "c" "d" "e")
is::array arr # succeeds (returns 0)
is::array str # fails (returns 1)

Arguments​

  • $1 (string): variable name

Exit codes​

  • 0: If the variable is an array
  • 1: If the variable is not an array

is::uninitialized​

bash rust

Check if a variable is uninitialized

Example​

local -a arr=("a" "b" "c" "d" "e")
is::uninitialized arr # fails (returns 1)
local -a str
is::uninitialized str # succeeds (returns 0)

Arguments​

  • $1 (string): variable name

Exit codes​

  • 0: If the variable is uninitialized
  • 1: If the variable is initialized

is::set​

bash rust

Check if a variable is set (initialized)

Example​

local -a arr=("a" "b" "c" "d" "e")
is::set arr # succeeds (returns 0)

Arguments​

  • $1 (string): variable name

Exit codes​

  • 0: If the variable is set
  • 1: If the variable is not set

is::tty​

bash rust

Check if terminal is a tty

Example​

is::tty # succeeds (returns 0)

Exit codes​

  • 0: If the terminal is a tty
  • 1: If the terminal is not a tty
Was this section helpful?