Eliminate variable checking in a script

RH Linux, $SHELL=/bin/ksh

I have a .profile which I source in as such --> . .profile

Whats happening is the variables are getting validated and generating errors.

for example

.profile
export foo=/to/the/moon

when I . .profile , I get

: not foundmyusername/.profile
or bad identifier

so the rest of my variables dont get set.

Is there a switch I can add to the top of the file ie

#!/bin/ksh -dontvaliddatemyvariables

thanks!
Bob

What do you mean by "validating variables"?

I can't tell what is going on by what you have posted.

when I source in a .profile, variables are somehow checked, and generating an error (listed)

contents of .profile

export foo=/a/location/that/dosnt/exist

when I source it it via . .profile
I get the error and other variables dont get set the script just craps out.
the error = : not foundmyusername/.profile
or bad identifier

this dosnt happen on other versions of UNIX - only some linuxes

so the interperter is checking of foos path is valid... if not if bombs out

Is this for only some specific variables?

How did these variables get set when .profile was run at login time?

Personally I don't use "export foo=anything"

I split them into two....

foo=anything
export foo

because "foo=anything" is not a variable you can export.

#############
I execute . profile manualy ie . .profile

you certianly can use export this way...

$ export VAR="Thanks for the reply"
$ echo $VAR
Thanks for the reply

It's shell specific. I lean to to the pedantic portable side.

Give it a go, see if it makes a difference.

Why does an error stop other variables being set?

Personally I've never heard of variable checking in an assignment statement, how would the shell have any idea what was valid. If what you are saying is correct I could not do...

foo=/new/directory/to/create
mkdir -p $foo

well... thanks for the sanity check. I seems there must have been some special (hidden) characters in the profile. I created a new file and the variables wourk as expected....

unreal-
Thanks
Bob

Not ^M or '\r' by any chance?

Actually... the weird part is I didnt see any ^M or the like.... Im using vi so they "should" show up....

In vi the file looked clean

Creating a new file worked, it surprised me actually. I was confinced they was some lking of error checking going on... :slight_smile:

Thanks

Bob