*BSD News Article 35519


Return to BSD News archive

Xref: sserve comp.unix.user-friendly:2862 comp.unix.solaris:22557 comp.unix.programmer:19876 comp.unix.misc:13824 comp.unix.aux:15429 comp.unix.bsd:14855 comp.unix.aix:43809
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.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
Date: 5 Sep 94 12:53:36
Organization: Telecom Australia - CSSC
Lines: 83
Distribution: inet
Message-ID: <CHRISB.94Sep5125336@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>
	<CHRISB.94Sep2111736@wombat.cssc-syd.tansu.com.au> <mrg.778672248@dynamo>
NNTP-Posting-Host: wombat.cssc-syd.tansu.com.au
In-reply-to: mrg@mame.mu.OZ.AU's message of Sun, 4 Sep 1994 09:50:48 GMT

In article <mrg.778672248@dynamo> mrg@mame.mu.OZ.AU (matthew green) writes:

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

true.

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

Why not? What bourne shell will this function not work on? Very old shells
without functions perhaps, but they don't count.

>   
>   setenv MYVAR xxx
>   
>   env | grep MYVAR
>
>this is not using 'sh', but rather an external 'env' program.

The whole point of using shells is to be able to start processes to do the
work for you. Why do you want every feature in the universe built into the
shell when a program will do just as well?

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

True, but I've never had cause to find out this info. If you have unusual
requirements the write a C program to do this. It wouldn't take long to
write.

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

Then use a V7 sh.