/usr/bin/du -k -s /home/e122/*
in a script beginnig with
#!/bin/csh -f
I get the error message "Arguments too long". This error also occurs when
run by hand in csh, but not with other similar lines in the script such as
/usr/bin/du -k -s /home/e86/*
or when run in tcsh. I've tried using "-ks" instead with no change.
Any ideas?
Thanks
Antonio Rodriguez
> /usr/bin/du -k -s /home/e122/*
> I get the error message "Arguments too long". This error also occurs when
> run by hand in csh, but not with other similar lines in the script such as
> /usr/bin/du -k -s /home/e86/*
commands are limited to a maximum total length of text. if a command
includes shell wildcards that expand to a length greater than that
maximum, an error is generated.
there must be more files in /home/e122 than in /home/e86. that's why
you get an error for e122 but not for e86.
anyway, here's one way to solve this problem:
cd to the directory in question and then run "/usr/bin/du -k -s *".
(remember to cd back to the original directory when you're done.)
this reduces the command length by several characters per directory.
the total savings can be large if "*" expands to many directories.
---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him." -- Robert Chang, rec.games.board
John Gordon gor...@osiris.cso.uiuc.edu
>When trying to run
>
>/usr/bin/du -k -s /home/e122/*
>
>in a script beginnig with
>
>#!/bin/csh -f
>
>I get the error message "Arguments too long".
as mentioned in another response, this happens because you've overflowed
the command line (in essence). what you need to do is to reduce the number
of directories presented to du, which means that du will have to be called
several times.
if you have gnu find and xargs then use them, e.g.,
find /home/e122 -type d -maxdepth 1 -print0 | xargs -0re du -ks
there are plenty of other ways, but if nothing else presents itself you'll
just have to iterate through the list of directories the "hard" way, e.g.,
: i don't do csh, this is bourne shell syntax
ls -1 /home/e122/ | while read dir && [ -n "$dir" ]; do
test -d "/home/e122/$dir" || continue
du -ks "/home/e122/$dir"
done
note: if you have that many directories within one directory your system is
probably spending a lot of time dealing with that; you should consider
adding another level.
--
okay, have a sig then