rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* backquote poser
@ 1993-03-09 11:32 John Mackin
  1993-03-09 12:13 ` mycroft
  0 siblings, 1 reply; 3+ messages in thread
From: John Mackin @ 1993-03-09 11:32 UTC (permalink / raw)
  To: The rc Mailing List

I was just writing an rc script where I wanted to assign a variable
the value of the output of the "domainname" command.  This command
might not be present on the system the script is being run on; if not,
I wanted the variable assigned the null list, and for no error message
about domainname not being found to be echoed onto the script's
standard error.  The best thing I could come up with was:

	domain = ` { exec >[2] /dev/null; domainname }

Anyone got a cleaner idea?  For some reason it seems to me it should
be able to be done more neatly.  I guess I mainly don't like needing
a semicolon.

OK,
John.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: backquote poser
  1993-03-09 11:32 backquote poser John Mackin
@ 1993-03-09 12:13 ` mycroft
  0 siblings, 0 replies; 3+ messages in thread
From: mycroft @ 1993-03-09 12:13 UTC (permalink / raw)
  To: rc


> 	domain = ` { exec >[2] /dev/null; domainname }
> 
> Anyone got a cleaner idea?  For some reason it seems to me it should
> be able to be done more neatly.  I guess I mainly don't like needing
> a semicolon.

Snippets from my .rcrc:

EDITOR=`{which vi >[2] /dev/null || echo /usr/ucb/vi}
PAGER=`{which less >[2] /dev/null || which more >[2] /dev/null}
UNSHAR=`{which unshar >[2] /dev/null || echo /bin/sh}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: backquote poser
@ 1993-03-09 12:28 Icarus Sparry
  0 siblings, 0 replies; 3+ messages in thread
From: Icarus Sparry @ 1993-03-09 12:28 UTC (permalink / raw)
  To: John; +Cc: The rc Mailing List

domain = `{ {domainname} >[2] /dev/null }
            ^ Actually I think an '@' should be needed here, but it appears
that one is optional.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1993-03-09 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-03-09 11:32 backquote poser John Mackin
1993-03-09 12:13 ` mycroft
1993-03-09 12:28 Icarus Sparry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).