Skip to content

Instantly share code, notes, and snippets.

@rpivo
Last active March 6, 2021 23:52
Show Gist options
  • Save rpivo/65b8a14143419b62dee1f92c187ae91e to your computer and use it in GitHub Desktop.
Save rpivo/65b8a14143419b62dee1f92c187ae91e to your computer and use it in GitHub Desktop.
If/Then Conditional Statements in Shell Scripts

If/Then Conditional Statements in Shell Scripts

The example below checks if the folder at bind-mount/package is empty.

if [ -z "$(ls -A bind-mount/package)" ]; then
  # do a thing here
else
  # else do a thing here
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment