*BSD News Article 35302


Return to BSD News archive

Xref: sserve comp.unix.user-friendly:2837 comp.unix.solaris:22244 comp.unix.programmer:19747 comp.unix.misc:13758 comp.unix.aux:15321 comp.unix.bsd:14812 comp.unix.aix:43534
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!wabbit.cc.uow.edu.au!picasso.cssc-syd.tansu.com.au!newshost!chrisb
From: chrisb@wombat.cssc-syd.tansu.com.au (Chris Bitmead)
Newsgroups: comp.unix.user-friendly,comp.unix.solaris,comp.unix.programmer,comp.unix.misc,comp.unix.aux,comp.unix.bsd,comp.unix.aix
Subject: Re: xargs and alias commands
Followup-To: comp.unix.user-friendly,comp.unix.solaris,comp.unix.programmer,comp.unix.misc,comp.unix.aux,comp.unix.bsd,comp.unix.aix
Date: 2 Sep 94 11:17:36
Organization: Telecom Australia - CSSC
Lines: 38
Distribution: inet
Message-ID: <CHRISB.94Sep2111736@wombat.cssc-syd.tansu.com.au>
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>
NNTP-Posting-Host: wombat.cssc-syd.tansu.com.au
In-reply-to: jsm@mitekgold1's message of 30 Aug 1994 19:42:12 GMT

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).

In bash and ksh you can type

export VAR=x

In standard bourne shell you can write a function:
If you like csh behaviour then enter this function:

setenv()
{
	eval "$1=$2"
	export "$1"
}

setenv MYVAR xxx

env | grep MYVAR

MYVAR=xxx