FlashKeepers

Bash and Shell · College · College and University

Bash II: Control Flow and Functions

Bash test operators, if, case, loops, functions, arrays, here-documents, traps and set options.

About this set

40 basic cards for College Bash and Shell. Set 2 of 2 in Bash. It opens with "What does [ -z STRING ] test?" and "What does [ -n STRING ] test?". Study it alongside the other College sets below.

40 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What does [ -z STRING ] test?
Show answerWhether STRING is empty
What does [ -n STRING ] test?
Show answerWhether STRING is non-empty
What does [ -f FILE ] test?
Show answerWhether FILE is a regular file
What does [ -d DIR ] test?
Show answerWhether DIR is a directory
What does [ -e FILE ] test?
Show answerWhether FILE or directory exists
What does [ -r FILE ] test?
Show answerWhether FILE is readable
What does [ $a -eq $b ] test?
Show answerWhether $a equals $b numerically
What does [ $a -lt $b ] test?
Show answerWhether $a is less than $b
What does [ $a -gt $b ] test?
Show answerWhether $a is greater than $b
What does [ $a -ge $b ] test?
Show answerWhether $a is greater than or equal to $b
What does [ "$a" = "$b" ] test?
Show answerWhether strings are equal
What does [ condition1 -a condition2 ] test?
Show answerWhether both conditions are true (AND)
What does [ condition1 -o condition2 ] test?
Show answerWhether either condition is true (OR)
When should you use [[ ]] instead of [ ]?
Show answerFor regex matching, to avoid word splitting, or easier quoting of variables
How do you write if with an else clause?
Show answerif CONDITION; then COMMANDS; else COMMANDS; fi

25 more cards in the app

Study this set free