albers@ka3ovk (Jon Albers) (06/07/91)
In trying to get Cnews to compile on our UNISYS 5000/95, I have come upon a problem with the shell scripts -- several of them have lines like: . ${NEWSCONFIG-/usr/lib/news/bin/config} It blows up on this line with the error 'Bad substitution', however, under SCO UNIX, it work just fine. What is it supposed to be doing? Jon -- | Jon Albers, IRS, Information Systems Management, Support and Installation. | | Office Symbols: ISM:S:S:SI voice: (202/FTS)535-3729 Packet: KA3OVK@N4QQ | | UUCP:(media|teemc|tcsc3b2|ki4pv)!ka3ovk!albers ARPA: JALBERS@SIMTEL20 |
mouse@thunder.mcrcim.mcgill.edu (der Mouse) (06/11/91)
In article <1991Jun06.172119.19494@ka3ovk>, albers@ka3ovk (Jon Albers) writes: [trying to install C news on a system with an oooold sh] > . ${NEWSCONFIG-/usr/lib/news/bin/config} > It blows up on this line with the error 'Bad substitution', however, > under SCO UNIX, it work just fine. What is it supposed to be doing? $NEWSCONFIG unless $NEWSCONFIG is not set, in which case /usr/lib/news/bin/config. Given the usage, you could do something like if [ "x$NEWSCONFIG" = "x" ]; then NEWSCONFIG=/usr/lib/news/bin/config fi . $NEWSCONFIG (This is not a general replacement for the ${name-string} syntax; it's not supposed to be. It's supposed to be something that *might* be good enough to get C news running for the original poster.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
dold@mitisft.Convergent.COM (Clarence Dold) (06/12/91)
in article <1991Jun06.172119.19494@ka3ovk>, albers@ka3ovk (Jon Albers) writes: > . ${NEWSCONFIG-/usr/lib/news/bin/config} > It blows up on this line with the error 'Bad substitution', however, > under SCO UNIX, it work just fine. What is it supposed to be doing? Isn't the correct syntax ":-" ? My shell likes it with or without the : . ${NEWSCONFIG:-/usr/lib/news/bin/config} ^ | -- --- Clarence A Dold - dold@tsmiti.Convergent.COM ...pyramid!ctnews!tsmiti!dold
chet@odin.INS.CWRU.Edu (Chet Ramey) (06/13/91)
In article <2142@mitisft.Convergent.COM> dold@mitisft.Convergent.COM (Clarence Dold) writes: >> . ${NEWSCONFIG-/usr/lib/news/bin/config} >Isn't the correct syntax ":-" ? My shell likes it with or without the : >. ${NEWSCONFIG:-/usr/lib/news/bin/config} No, not necessarily. The `-' causes sh to substitute the RHS if the LHS is unset. The `:-' causes substitution if the LHS is unset or null. Chet -- ``You shoot John Sununu. Twice.'' Chet Ramey Internet: chet@po.CWRU.Edu Case Western Reserve University NeXT Mail: chet@macbeth.INS.CWRU.Edu
jeff@onion.rain.com (Jeff Beadles) (06/13/91)
dold@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@onion.rain.com