[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Shell script silently exits. Why?
From:       Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn () axis ! com>
Date:       2016-11-29 15:57:34
Message-ID: alpine.DEB.2.20.1611291652310.31307 () enwn ! fr ! nkvf ! pbz
[Download RAW message or body]

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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic