[comp.unix.questions] KSH .profile problem - Why doesn't this work and how to make it work?

jeffo@mrcnext.uiuc.edu (Jeffrey B Nicholson) (03/08/91)

My .profile has a really long export line because I have quite a few variables
that I wish to export.  As far as I can tell, it's legal to say:

var1=value1
var2=value2
..
varN=valueN
export var1 var2 .. varN

Or you could just say:

export var1=value1 var2=value2 .. varN=valueN

Correct?

Well, I have a problem with this assignment:

export LESS=wh`expr ${LINES} - 2`x8b10

Here, I am trying to calculate ${LINES} - 2 and stick that result immediately
after the "wh".  As such, it causes a syntax error when I login and I can't
find the problem.

One thing I've tried is putting the whole line as the argument of an eval, so
it reads:

eval export LESS=wh`expr ${LINES} - 2`x8b10

but that causes:

${HOME:-.}/.profile[2]: jeffo: cannot open

when I login.  The huge export line is the second line of my .profile.

When I execute LESS=wh`expr ${LINES} - 2`x8b10 on the command line, it works
like a charm.  Also, if I export that definition (just toss an export in front
of that) it works fine.  I don't understand why it wouldn't work in my
.profile.

Can anyone help?  Thanks in advance.

Jeff
--
+---------------------------------------------+------------------------------+
|*These opinions are mine*  This .signature is|...!uiuc.edu!jeffo  (UUCP'ish)|
|mine.  Everything you have just read is mine.|  jeffo@uiuc.edu  (ARPA'ish)  |
+---------------------------------------------+------------------------------+
| "Earth destroyed by solar flare.  Film at eleven."  The last nightly news. |
| "Fast, Cheap, Good:  Choose any two."            Rule for a lot of things. |
+----------------------------------------------------------------------------+

reso@fmsrl7.srl.ford.com (Dennis M. Reso) (03/15/91)

In article <jeffo.668400965@mrcnext> jeffo@uiuc.edu writes:
> My .profile has a really long export line because I have quite a few variables
> that I wish to export.

See your ksh man page for the "set" builtin command. Most Bourne and
Korn shells that I have seen support

     set -a
     VAR1=value
     ...
     VARn=value
     set +a

The "set -a" says mark all newly created variables as "export", and
the "set +a" turns the feature off.





____________________________________________________________________________
pms415!reso@fmsrl7.srl.ford.com             sevihc!reso@sharkey.cc.umich.edu
RESO -ON D1D1                               {sharkey|hela}!sevihc!reso
Ford - Car Product Development, CAD/CAM     Sterling Heights, MI USA
Bldg3 1st Floor #1152 (313) 322-5867        (313) 939-2789