![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lines too long error | thana | UNIX for Dummies Questions & Answers | 2 | 05-09-2008 10:12 AM |
| word too long..problem while sourcing .cshrc | mobydick | UNIX for Dummies Questions & Answers | 1 | 05-08-2008 10:11 PM |
| word too long | panchpan | SUN Solaris | 7 | 02-04-2008 04:34 AM |
| Can a shell script pull the first word (or nth word) off each line of a text file? | tricky | Shell Programming and Scripting | 5 | 08-17-2006 07:29 AM |
| arguments too long error | kburrows | Shell Programming and Scripting | 0 | 07-21-2006 12:35 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
word too long error in script but not elsewhere...
Hi,
I have written a tcsh script that reads 3 directories, lists the files within them and continues on to evaluate each file independently. When I run the script, it gets to a certain directory that contains ~250 files, when you echo the directory, there are 4332 characters. So, when I use the echo command to list the files within that directory within the shell script, it produces a "word too long" error. The confusing thing is that when I run the commands directly in the shell (i.e., not through a script, type each command separately), I don't get the error. Is there anyone out there that can help me understand why the script fails, but running the commands directly in the shell does not result in an error? Here is the list of the directories: drwxr-sr-x 2 4096 Jan 21 10:37 SRS00001 drwxr-sr-x 2 4096 Jan 20 18:27 SRS00008 drwxr-sr-x 2 4096 Jan 21 11:04 SRS00009 Here is the section of the script (and output) that is failing: set dlist = (); set flist = ( `ls -d *` ) foreach f ($flist) if ( -d $f ) set dlist = ( $dlist $f ) echo "dlist = $dlist" ------------------------------------------------------ output of the echo command for each iteration: dlist = SRS00001 dlist = SRS00001 SRS00008 dlist = SRS00001 SRS00008 SRS00009 ------------------------------------------------------ end foreach d ( $dlist ) set flist = ( `find $d -name "*"` ) echo $flist ------------------------------------------------------ output of the echo command for each iteration: SRS00001 SRS00001/IMG00000 SRS00001/IMG00001 ... SRS00001/IMG00049 SRS00008 SRS00008/IMG00000 SRS00008/IMG00001 ... SRS00008/IMG00024 SRS00009 SRS00009/IMG00000 SRS00009/IMG00001 ... SRS00009/IMG00247 ------------------------------------------------------ end As you can see, the last directory contains 248 images, resulting in an echo output of more than 4000 characters. I assume this is why I get the "word too long" error when I run the script, but why does it work when I manually type in the command in the shell? I've been struggling with this for 2 days, and the script won't continue once it hits this directory, so I can't move on from this point. If anyone can help, it would be greatly appreciated. Thank you in advance! nix |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|