KSH .profile problem - Why doesn't this work and how to make it work?

KSH .profile problem - Why doesn't this work and how to make it work?

Post by Jeffrey B Nichols » Sat, 09 Mar 1991 11:56:05

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:

export var1 var2 .. varN

Or you could just say:

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


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

Can anyone help?  Thanks in advance.

|*These opinions are mine*  This .signature is|...!uiuc.edu!jeffo  (UUCP'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. |


KSH .profile problem - Why doesn't this work and how to make it work?

Post by Dennis M. Re » Sat, 16 Mar 1991 04:19:27

> 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
     set +a

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


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


1. ksh children won't die ; exec doesn't work properly; ksh -p

I'm having problems with Korn shell's exec ...I have converted
some old csh scripts to ksh, which seems to have worked fine,
except for two problems:-

(1) When I kill the parent process - the child processes do not
all die!!! (This one is driving me up the wall).  

Complication: I need to keep one child alive (I use nohup ... & for this)
As the children did not die with their parent, I tried to
kill them in the parent's interupt routine with kill -hup 0
- unfortunately this results in an infinite loop into the
interupt routine ...of course!

(2) When I exec another ksh script, instead of overwriting
the current process - a child process is spawned....why
for heaven sake???

One more question.  What exactly does ksh -p do for me (I thought
it just prevent the ksh reading my .profile, and so would
be good to place on the first line of my scripts, however according
to "Unix Desktop Guide to the Korn Shell" ( a better book than
Korn book for most things IMHO) it described this option as
"Set protected mode" but fails to elaborate further.

I'd be grateful for any help or suggestions.  (E-mail response
would be preferred, but I'll try to check back here.)

"As the leader in the cellular industry and a company that places top priority
on the interests and concerns of our customers and the public, we intend to
address these concerns in a straightforward, responsible manner.
..First, let me assure you that all of our products are safe."- Pres. Motorola GSS

2. Has anyone REALLY used Applix Office Suite?

3. Why doesn't this work ?? (ksh)

4. Assembler opcode CALL with +0 offset

5. Re. bffcreate -X doesn't work Re: bffcreate -X Doesn't Work

6. Starting hotplug sevices [net pci usb takes many minutes during startup

7. Why doesn't this ksh script work?

8. concordance script

9. Why doesn't \c work in sh/ksh echo on Suns?

10. ppp-2.2 doesn't work whereas ppp2.1.2d works - why?

11. PPP connection works well ,while SLIP connection doesn't work,why and how?

12. nohup (script1.ksh ; script2.ksh ) & doesn't work

13. Why doesn't sed 's/$/^M/' work as expected?