From: Seebs on
On 2010-02-11, Pankaj <harpreet.noni(a)gmail.com> wrote:
> Thanks Seebs But isnt the error message I am getting is a bit
> "misleading"? I mean why am I not getting "permission denied" as you.
> "Not found" error makes a total different meaning here.

No clue. It could be that it's a wildly different version of ksh, or
that it's trying to find an executable of that name in $PATH or something
crazy. I think I was actually testing with an old pdksh that I had lying
around.

But here's the thing: No matter what messages you get, I can guarantee
you that, if you don't own that file, and it's -rwx------, either you can't
use it or your system has a security hole the size of a large continent.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Bill Marcum on
On 2010-02-11, Pankaj <harpreet.noni(a)gmail.com> wrote:
> Greetings,
>
> I have a environment file in my test directory on DEV host
>
> $ ls -ltr /dev/test/env_test
> $ rwx------ 1 May 11 2006 env_test
>
> But if I try to access this file in a script I get file not found
> error
>
> $ cat test.ksh
>
> #! /bin/ksh -p
>
> . /dev/test/env_test
>
> $ test.ksh
> test.ksh[2]: /dev/test/env_test: not found
>
What is in env_test? Could it be some command in that file causing the
"not found" error?
From: Ben Bacarisse on
Pankaj <harpreet.noni(a)gmail.com> writes:

> On Feb 11, 5:42 pm, Seebs <usenet-nos...(a)seebs.net> wrote:
>> On 2010-02-11, Pankaj <harpreet.n...(a)gmail.com> wrote:
>>
>> > $ file=/testing/test/env_test
>> > $ ls -l "$file"
>> > -rwx------   1 32471        3277 May 11  2006 /testing/test/env_test
>> > $ . $file
>> > ksh: /testing/test/env_test:  not found
>> > $
>> > Ah, the permission part I have not taken into consideration. Actually,
>> > this script is owned by another user and I am trying to run it using
>> > my own credentials. Could this be the issue?
>>
>> Yes.  Note that it's "-rwx------".  That means only that user can read
>> it or execute it.  Although my ksh helpfully says:
>>
>> test.ksh[2]: .: /tmp/env_test: Permission denied
>>
>
> Thanks Seebs But isnt the error message I am getting is a bit
> "misleading"? I mean why am I not getting "permission denied" as you.
> "Not found" error makes a total different meaning here.

You might get "not found" if ksh can't traverse the path to get to the
file. I.e. I'd check the access permissions on /testing and
/testing/test. This is just a guess since I am not a ksh user. Bash
reports "permission denied" in such situations so it is a long shot.

--
Ben.
From: Pankaj on
On Feb 11, 7:07 pm, Ben Bacarisse <ben.use...(a)bsb.me.uk> wrote:
> Pankaj <harpreet.n...(a)gmail.com> writes:
> > On Feb 11, 5:42 pm, Seebs <usenet-nos...(a)seebs.net> wrote:
> >> On 2010-02-11, Pankaj <harpreet.n...(a)gmail.com> wrote:
>
> >> > $ file=/testing/test/env_test
> >> > $ ls -l "$file"
> >> > -rwx------   1 32471        3277 May 11  2006 /testing/test/env_test
> >> > $ . $file
> >> > ksh: /testing/test/env_test:  not found
> >> > $
> >> > Ah, the permission part I have not taken into consideration. Actually,
> >> > this script is owned by another user and I am trying to run it using
> >> > my own credentials. Could this be the issue?
>
> >> Yes.  Note that it's "-rwx------".  That means only that user can read
> >> it or execute it.  Although my ksh helpfully says:
>
> >> test.ksh[2]: .: /tmp/env_test: Permission denied
>
> > Thanks Seebs But isnt the error message I am getting is a bit
> > "misleading"? I mean why am I not getting "permission denied" as you.
> > "Not found" error makes a total different meaning here.
>
> You might get "not found" if ksh can't traverse the path to get to the
> file.  I.e. I'd check the access permissions on /testing and
> /testing/test.  This is just a guess since I am not a ksh user.  Bash
> reports "permission denied" in such situations so it is a long shot.
>
> --
> Ben.- Hide quoted text -
>
> - Show quoted text -

Thanks everyone.

Seebs: It seems I dont have necessary access to login as the owner of
that file to execute it. I will check with my superiors here. For now,
the user permissions is our best bet.

Bill: The env file is strictly used for intializing variables that are
then accesses in subsequent files. There is not command which is
getting executed in this file.

Ben: Thanks Ben.
From: Ed Morton on
On 2/11/2010 2:56 PM, Pankaj wrote:
> Greetings,
>
> I have a environment file in my test directory on DEV host
>
> $ ls -ltr /dev/test/env_test
> $ rwx------ 1 May 11 2006 env_test
>
> But if I try to access this file in a script I get file not found
> error
>
> $ cat test.ksh
>
> #! /bin/ksh -p
>
> . /dev/test/env_test
>
> $ test.ksh
> test.ksh[2]: /dev/test/env_test: not found
>
> I am working on this for an hour now. What is going on? Any help would
> be appreciated.
>
> I am running it under a solaris box in ksh

Are you the owner of /dev/test/env_test? According to the permissions you show,
only the owner can read, write, or execute it.

Ed.