Tech Support > Operating Systems > UNIX / Variants > ./fullpath/myshell execution issues
./fullpath/myshell execution issues
Posted by yls177 on July 12th, 2003


hi, i did the below

root@myhost:/1/2/3] ./1/2/3/4/myshell.sh
ksh: ./1/2/3/4/myshell.sh: not found.

but when i go to root directory
root@myhost:]./1/2/3/4/myshell.sh and this works


the difference is in the pwd which i am in. but i am puzzled cos when
i execute the shell (as in ./myshell.sh, i specify the full path.)

thanks

Posted by Len Philpot on July 12th, 2003


yls177 <yls177@hotmail.com> wrote:
If I read this right, here's the issue :


When you're in /1/2/3 and issue ./1/2/3/4/myshell.sh, you're really
telling the shell to execute /1/2/3/1/2/3/4/myshell.sh. Notice the
current directory dot that prefaces the path, making 1/2/3/4 relative
from that location.


....and here, using ./1/2/3/4/myshell.sh is correct, since ./1/2/3/4
relative from root _is_ /1/2/3/4.


Ah, but with the ./, you're _not_ specifying the full path, but rather a
relative path. So what you'd need to do from /1/2/3 is ./4/myshell.sh,
unless I've made a reading error. Either that or leave off the dot.

--

-- Len Philpot ><> --
-- len@philpot.org http://philpot.org/ --
-- lphilpot01@yahoo.com (alternate email) --

Posted by yls177 on July 15th, 2003


len@philpot.org (Len Philpot) wrote in message news:<vgv1s57i6bc9c7@corp.supernews.com>...

right.. thanks for clarifying

Posted by Len Philpot on July 16th, 2003


yls177 <yls177@hotmail.com> wrote:
I wouldn't count on it. I ran into a situation on Solaris 2.6 where
entries in root's crontab ran as root, but not with root's full
environment. In other words, utilites that were in root's $PATH didn't
run because the cron job didn't get the $PATH. I always specify full
path in crontab entries.

Now, if you're asking will "/ranthis" run rathis that happens to be
located in the root directory, you're right. As written, your entry
isn't complete. Here's an excerpt from the crontab(5) man page :

The time and date fields are:

field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)

The actual command field follows these five. * means any value, so * in
the minute field would run the command once _every_ minute.

--

-- Len Philpot ><> --
-- len@philpot.org http://philpot.org/ --
-- lphilpot01@yahoo.com (alternate email) --


Similar Posts