FIND YOUR NEXT FEW LINES

Results for “empty”

Small, practical examples. Search by task or narrow things down below.

487 snippets foundClear filters
Bash ScriptsArray operations

Check exact array membership

Bash Scripts: Compare each element literally instead of searching a concatenated string.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check for an installed command

Bash Scripts: command -v checks command resolution without assuming a specific installation path.

Bash Scripts✓ Tested
PostgresJSON & arrays

Check JSONB containment

Test whether an object contains a key-value pair.

jsonb✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check whether a function has been defined

Bash Scripts: declare -F tests a function name without executing it.

Bash Scripts✓ Tested
Bash ScriptsDiagnostics & defensive scripting

Check whether a variable exists under nounset

Bash Scripts: The plus expansion distinguishes an unset variable without reading its missing value.

Bash Scripts✓ Tested
JavaScriptArray traversal & selection

Check whether every item matches

JavaScript: every stops at the first failed predicate and returns true for an empty array.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Check whether every item matches

TypeScript: every stops at the first failed predicate and returns true for an empty array.

TypeScript✓ Tested
Bash ScriptsLoops & decisions

Check whether input is a nonnegative integer

Reject empty input and nonnumeric characters before arithmetic.

validation✓ Tested
Linux CommandsGetting Started

Check whether two practice files match

Linux Commands: Check whether two practice files match using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
Bash ScriptsArguments & decisions

Choose among several numeric ranges

Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.

Bash Scripts✓ Tested
Bash ScriptsGetting Started

Choose an action with case

Bash Scripts: Choose an action with case with a small standalone Bash program.

Bash Scripts✓ Tested
Docker / ComposeGetting Started

Choose an image’s default directory

Docker / Compose: Choose an image’s default directory with a complete introductory Dockerfile.

Docker / Compose✓ Tested