*BSD News Article 35449


Return to BSD News archive

Xref: sserve comp.unix.user-friendly:2853 comp.unix.solaris:22472 comp.unix.programmer:19835 comp.unix.misc:13802 comp.unix.aux:15404 comp.unix.bsd:14845 comp.unix.aix:43740
Newsgroups: comp.unix.user-friendly,comp.unix.solaris,comp.unix.programmer,comp.unix.misc,comp.unix.aux,comp.unix.bsd,comp.unix.aix
Path: sserve!newshost.anu.edu.au!munnari.oz.au!cs.mu.OZ.AU!mrg
From: mrg@mame.mu.OZ.AU (matthew green)
Subject: Re: xargs and alias commands
Message-ID: <mrg.778672248@dynamo>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
X-Newsreader: NN version 6.5.0 #4
References: <33af70$8rd@usenet.INS.CWRU.Edu> <33e3kt$i1i@wombat.cssc-syd.tansu.com.au> 	<CHRISB.94Aug29144419@wombat.cssc-syd.tansu.com.au> 	<34022k$4lu@news.cerf.net> <CHRISB.94Sep2111736@wombat.cssc-syd.tansu.com.au>
Date: Sun, 4 Sep 1994 09:50:48 GMT
Lines: 66

chrisb@wombat.cssc-syd.tansu.com.au (Chris Bitmead) writes:

   In article <34022k$4lu@news.cerf.net> jsm@mitekgold1 (Shane McRoberts) writes:
   
   >Chris Bitmead (chrisb@wombat.cssc-syd.tansu.com.au) wrote:
   >: I'll be the first to back up BSD in many areas, but csh would not be one
   >: of them. The design flaws in csh are well documented. What is it that you
   >: can do in csh that you can't do in the bourne flavoured shells?
   >
   >setenv.  This one bugs me.  Is there any way in sh/ksh/bash to set an
   >exported variable in a single command?  How about listing only exported
   >or non-exported variables?
   
   Well you can type:
   
   VAR=x export VAR
   
   which is technically one command. (Note there is no semi-colon between the
   VAR=x and export VAR).

yeah, but it's redundant (not that a lot of shell stuff isn't...)
   
   In bash and ksh you can type
   
   export VAR=x

yup.  i like that.
   
   In standard bourne shell you can write a function:
   If you like csh behaviour then enter this function:
   
   setenv()
   {
   	eval "$1=$2"
   	export "$1"
   }

um, this is *not* portable sh.
   
   setenv MYVAR xxx
   
   env | grep MYVAR

this is not using 'sh', but rather an external 'env' program.
   
   MYVAR=xxx


-- 
rockwell@nova.umd.edu (Raul Deluth Miller) writes:

   export FOO=3

that is not portable sh.

   sh -c 'set'

this does not separate environment and shell variables.


personally, i think all the current shells suck.  i use tcsh because
i'm comfortable in it and it mostly does `what i need' (not to be
confused with `what i think i need'), but i'd rather a V7 sh to csh
anyday.

.mrg.