Operating System - Linux
1748089 Members
4854 Online
108758 Solutions
New Discussion юеВ

Re: $PATH variable" word is to long"

 
SOLVED
Go to solution
Voda
Advisor

$PATH variable" word is to long"

Hi All,
Could someone help me to find a solution regarding the PATH variable in .tcshrc file.
I have to add some paths in this in order to run some scripts but there are a loot of directories when the script resides and when i write them it shows me the message below.
When i log into the system:

"word is to long"
%

Thanks
Endrin
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: $PATH variable" word is to long"

A Google search indicates that this is a hard-coded limit in tcsh. One way to shorten the PATH for deeply nested directories is to create symbolic links so that you can skip over several layers of directories and thus use a shorter PATH. Your other problem may be that you are already sourcing /etc/PATH and PATH is already too long. A very long /etc/PATH is likely a security hole.
If it ain't broke, I can fix that.
Peter Nikitka
Honored Contributor
Solution

Re: $PATH variable" word is to long"

Hi,

even in tcsh you cannot raise the limit of the number of characters allowed in an environment variable. The limit (4096) at Solaris10 is high, however.

Keep in mind, that it is better in tcsh to deal with the (local) variable 'path' as array as with the environment variable PATH.
tcsh tracks the correspondence of 'path' and 'PATH' by itself automatically.

To refine Clay's suggestion - which is the only resonable solution:
1) Check if the directory exists before appending it to path:
if (-f /more/to/add/to/path) then
set path=($path /more/to/add/to/path)
endif

2) Create aliases for entries of directories you want to put into PATH, which contain only few executables:
instead of adding /path/to/script to path, where /path/to/script/start_me is the only executable file, use
alias start_me /path/to/script/start_me

3) Check for duplicates (links!) in path:
set addme=1
set to_add=/path/of/new/to/add
foreach p in ($path)
if ($p == $to_add) then
set addme=0
breaksw
endif
end
if ($addme) set path=($path $to_add)

- /bin and /usr/bin are redundant entries
- contains /usr/local/bin really some files?

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Voda
Advisor

Re: $PATH variable" word is to long"

As i can see there is no hope on extending the PATH variable size on which i wanted to add the directories where the scripts reside.

I have installed Sudo version 1.6.8p12 and have some scripts on a lot of directories. In the sudoers file i have defined them like below:
/ddd/sss/ddd/* but i have recently heard that this version doesn't work with the wildcard.
So i have to add the full path of each script in the sudoers file in order to run the scripts.
As there are a lot of them i wanted to know if exist any size limitation on the sudoers file?
Voda
Advisor

Re: $PATH variable" word is to long"

Case resolved by implementing sudo