Shell script silently exits. Why?

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Tue Nov 29 15:57:34 UTC 2016


On Tue, 29 Nov 2016, Pavel A wrote:
>
> Is it possible to test for active option within ash script?
> My version of ash does not seem to recognize "test -o" or [ -o errexit ]

To test on errexit you'd do something like:

	case $- in
		*e*)
			echo errexit set
			;;
		*)
			echo errexit not set
			;;
	esac

The $- thing:

Special Parameters

     - (Hyphen.)  Expands to the current option flags (the single-letter
                  option names concatenated into a string) as specified on
                  invocation, by the set builtin command, or implicitly by the
                  shell.


Cheers,

-- 
Cristian


More information about the busybox mailing list