2
3
4yes_no() {
5 declare desc="Prompt for confirmation. \$\"\{1\}\": confirmation message." 6 local arg1="${1}"
7
8 local response=
2
3
4countdown() {
5 declare desc="A simple countdown. Source: https://superuser.com/a/611582" 6 local seconds="${1}"
7 local d=$(($(date +%s) + "${seconds}"))
8 while [ "$d" -ge `date +%s` ]; do
1#!/usr/bin/env bash
2
3
4BACKUP_DIR_PATH='/backups'5BACKUP_FILE_PREFIX='backup'
2
3
4BACKUP_DIR_PATH='/backups'
5BACKUP_FILE_PREFIX='backup'
Variables that are declared but not used for anything should be removed.
foo=42
echo "$FOO"
foo=42
echo "$foo"
This warning may be falsely emitted when a variable is referenced indirectly, or it is intentionally not used.
# foo generates a warning, even though it has five indirect references
foo=42
name=foo
echo "${!name} $((name))"
export "$name"; eval "echo $name"
declare -n name; echo "$name"
This is an intentional design decision and not a bug. If you have variables that will not have direct references, consider using an associative array in bash, or ignore this warning.
_
as a dummy:read _ last _ zip _ _ <<< "$str"
echo "$last, $zip"