Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 exptools 1/6/84; site ihuxt.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!ihuxt!martillo From: martillo@ihuxt.UUCP (Yehoyaqim Martillo) Newsgroups: net.unix-wizards Subject: Re: Why parse lines with colons Message-ID: <641@ihuxt.UUCP> Date: Thu, 12-Jul-84 13:07:51 EDT Article-I.D.: ihuxt.641 Posted: Thu Jul 12 13:07:51 1984 Date-Received: Fri, 13-Jul-84 04:33:27 EDT References: <526@spuxll.UUCP> Organization: AT&T Bell Labs, Naperville, IL Lines: 37 >One of the reasons /bin/sh (bsh to those who like csh) >parses lines with ":" in the beginning is because of >constructs like the following: >: ${FOO:-default} >This effectively sets $FOO to a default value if not previously >set. According to my shell manual the value of this expression is $FOO is FOO is set and not not null otherwise, the value is default. The value of FOO does not change. I believe he means : ${FOO:=default} >The longhand way would be: >if [ "${FOO}" = "" ] >then > FOO=default >fi He could just as well have used: FOO=${FOO:-default} which avoids the ":" and takes hardly any (and probably no) more time to execute. -- Who wouldn't break for whales? Yehoyaqim Shemtob Martillo