# Indicate use of bash in shell script
# Set environment variable
video_files_dir="/home/user/my-videos"
if [ condition1 ] || [ condition2 ]; then
#Code to execute if either condition1 or condition2 is true
if [ condition1 ] && [ condition2 ]; then
#Code to execute if both condition1 and condition2 are true
#Code to execute if the condition is false
# Check if a file exists before doing something
if [ -f ~/.bash_aliases ]; then
# -d - check for directory
# Check if a command exists before using it
if command -v carapace &>/dev/null; then
export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional
source <(carapace _carapace)
# Create a function and set local to function variables
# Go up a number of directories in the function argument
if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
for ((i = 1; i <= limit; i++)); do
# perform cd. Show error if cd fails
echo "Couldn't go up $limit dirs."
# Check arguments passed to a function or script
local to_download="downloads.txt"
# Case statement on different arguments
yt-dlp -S "res:720" -a "$to_download"
yt-dlp -s "res:480" -a "$to_download"
# Change directory or exit or there is a problem going to directory
cd "/path/to/my-videos" || exit
echo "Retrieving link from first clipboard item"
# Set a variable from output of a command
read -r -p "Enter input: " input
read -rs -p "Enter password: " PASSWORD
# -r do not allow backslashes to escape any characters
# Create directory and any parent folders needed, do not give error if directories exist
mkdir -p /path/to/new-dir