/bin/true

Doug Gwyn gwyn at brl-smoke.ARPA
Sat May 10 08:25:51 AEST 1986


In article <154 at toram.UUCP> chris at toram.UUCP (Chris Robertson) writes:
>In shell scripts, I find setting a variable to "true" or "false" and then
>simply saying "if $variable" can often make the code more readable than an
>explicit "test" or using a case statement.

Consider the following approach, which has lower overhead:

	flag=

	...

	if [ stuff-that-needs-to-set-flag ]	# for example
	then	flag=y
	fi

	...

	if [ "$flag" ]
	then	# flag was set
	fi



More information about the Comp.unix mailing list