2 added 66 characters in body
source | link

It depends - as a dollar-sign expansion, $- expands to a list of the current shell's settable single-letter options - such as -x and -f and -C. For an example, an interactive shell will expand it at least like:

echo "$-"

i

The longer, set -o option versions can be had with set +o.

But there is another kind of hyphen-special-parameter which is a sort of analog to this. You can use two consecutive hyphens to signal the end of options in a typical command's argument list, but you can also use a single-hypen to do the same for a POSIX-shell. Historically, shells accepted a single hyphen to mean much the same.

A bash shell interprets a single-hyphen specially in argument list-contexts. With set, for example it marks the end of options and disables -verbose and -xtrace. Additionally, set - does not clear a parameter list if it is the first and only argument to set as set -- would.

A login shell will often append a - to its argv[0].

It depends - as a dollar-sign expansion, $- expands to a list of the current shell's settable single-letter options - such as -x and -f and -C. For an example, an interactive shell will expand it at least like:

echo "$-"

i

But there is another kind of hyphen-special-parameter which is a sort of analog to this. You can use two consecutive hyphens to signal the end of options in a typical command's argument list, but you can also use a single-hypen to do the same for a POSIX-shell. Historically, shells accepted a single hyphen to mean much the same.

A bash shell interprets a single-hyphen specially in argument list-contexts. With set, for example it marks the end of options and disables -verbose and -xtrace. Additionally, set - does not clear a parameter list if it is the first and only argument to set as set -- would.

It depends - as a dollar-sign expansion, $- expands to a list of the current shell's settable single-letter options - such as -x and -f and -C. For an example, an interactive shell will expand it at least like:

echo "$-"

i

The longer, set -o option versions can be had with set +o.

But there is another kind of hyphen-special-parameter which is a sort of analog to this. You can use two consecutive hyphens to signal the end of options in a typical command's argument list, but you can also use a single-hypen to do the same for a POSIX-shell. Historically, shells accepted a single hyphen to mean much the same.

A bash shell interprets a single-hyphen specially in argument list-contexts. With set, for example it marks the end of options and disables -verbose and -xtrace. Additionally, set - does not clear a parameter list if it is the first and only argument to set as set -- would.

A login shell will often append a - to its argv[0].

1
source | link

It depends - as a dollar-sign expansion, $- expands to a list of the current shell's settable single-letter options - such as -x and -f and -C. For an example, an interactive shell will expand it at least like:

echo "$-"

i

But there is another kind of hyphen-special-parameter which is a sort of analog to this. You can use two consecutive hyphens to signal the end of options in a typical command's argument list, but you can also use a single-hypen to do the same for a POSIX-shell. Historically, shells accepted a single hyphen to mean much the same.

A bash shell interprets a single-hyphen specially in argument list-contexts. With set, for example it marks the end of options and disables -verbose and -xtrace. Additionally, set - does not clear a parameter list if it is the first and only argument to set as set -- would.