special-parameter
Bash $- — current option flags
Expands to the current single-letter shell option flags. The specific letters depend on invocation and options.
Formal Syntax & Structure
bash syntaxbash
$-Return Value
string
Current option letters.
Working Example
Example Snippetbash
true &job=$!wait "$job"printf 'job status=%s\n' "$?"printf 'flags=%s\n' "$-"