Operating System - HP-UX
1833875 Members
1674 Online
110063 Solutions
New Discussion

[help]pathname too long[help]

 
SOLVED
Go to solution
zhangr_2
Advisor

[help]pathname too long[help]

Hi,
I meet a problem.
in my environment,I use csh.and one day I found all of my csh script are not work .when type the script name ,the system only give "pathname too long".even the script only have one line like this:
#! /usr/bin/csh
ls -l
if I change the script to sh, like this:
#! /usr/bin/sh
ls -l
it can work properly.
I just wondering ,what is the meaning of pathname to long, does the csh have some restricts of the length of PATH?because I only add 5 path in ~/.cshrc like this:
set path=( $path /usr/sbin /opt/gcc/bin /opt/perl5/bin/perl /usr/local/bin . /opt/nmp/adm/stool )
and if I remove all the path from my .cshrc and the csh script can run properly.

6 REPLIES 6
malay boy
Trusted Contributor
Solution

Re: [help]pathname too long[help]

Hi Zhang,
I have added 6 path in the .cshrc.And it's working fine.What are you OS level.Mine is 11.00.

regards
mB
There are three person in my team-Me ,myself and I.
zhangr_2
Advisor

Re: [help]pathname too long[help]

my os is hp-ux 11i
and I just use the echo $PATH and found that my $PATH are really too long ,almost 1189 character . does the csh ENV have some restrict on the length of the $PATH ?

Thanks in advance.
twang
Honored Contributor

Re: [help]pathname too long[help]

The limit for a variable in csh is 1024 characters. But I think there is no limit for the path length.
Please run this and see:
# echo $PATH | wc -c
Pauline Brasch
Frequent Advisor

Re: [help]pathname too long[help]

Hi
The pathname limit is 1024 characters in csh. I'm suspecting the brackets might cause the problem... you could try setting noglob before the path statement in your script (see man page for csh).
Also, if there are nulls or white space in the enviornment variable value, you can see this problem... I'm guessing that the " . " in the above set path statement might be your problem!

Good Luck :)
The time is gone the song is over thought I'd something more to say.
Tim Adamson_1
Honored Contributor

Re: [help]pathname too long[help]

Hi,

From the csh man page:

noglob - If set, file name expansion is inhibited. This is most useful in shell scripts that are not dealing with file names, or after a list of file names has been obtained and further expansions are not desirable.

So maybe you need to do a "set noglob" before setting the path and "unset noglob" after setting the path.

Hope it helps!

Yesterday is history, tomorrow is a mystery, today is a gift. That's why it's called the present.
twang
Honored Contributor

Re: [help]pathname too long[help]

Agree with Malay, you should have a look at the patch level. Do you have patch PHCO_19434 on the system. It might solve your problem. This is the csh patch for UX 10.20.