# Choosing

Choosing: If This, Then That: if and \[\[ \]\], Checking Before You Act: File Tests, Menus and Choices: case and select.

Updated: November 10, 2026

1. [If This, Then That: if and \[\[ \]\]](https://www.ask-codey.com/lessons/bash-if-statements) (Apprentice): if lets a script choose: the commands after then run only when a test passes, \[\[ \]\] compares text with == and whole numbers with -lt and its friends, and if can also ask whether any command worked.
2. [Checking Before You Act: File Tests](https://www.ask-codey.com/lessons/bash-file-tests) (Apprentice): File tests let a script look before it acts: -e asks whether a path exists, -f and -d whether it's a file or a folder, -s whether a file has anything in it, and -nt whether it's newer than another.
3. [Menus and Choices: case and select](https://www.ask-codey.com/lessons/bash-case-and-select) (Apprentice): case matches one value against a list of patterns and runs the lines for the first match, which suits a script's options and yes-or-no answers, and select turns a list of words into a numbered menu.

Source: https://www.ask-codey.com/courses/bash-in-depth/topics/bash-choosing
