What does this sh script line do?

Jeff Beadles jeff at onion.rain.com
Thu Jun 13 14:14:27 AEST 1991


dold at mitisft.Convergent.COM (Clarence Dold) writes:

>Isn't the correct syntax ":-" ?  My shell likes it with or without the : 
>. ${NEWSCONFIG:-/usr/lib/news/bin/config}
>              ^

Depends on what you want.  The variable is expanded as:

If the NEWSCONFIG variable is set and non-null, use it, else use "/usr/..."

Without the colon, take the above line and delete "and non-null,"

Note, that the ':' operator is not very portable.  I've ran into a couple of
systems that don't support it.

By the way, the ':' is discussed in "tfm" under "Parameter Substution..." :-)

	-Jeff
-- 
Jeff Beadles		jeff at onion.rain.com



More information about the Comp.unix.questions mailing list