Sponsored Content
Full Discussion: ls is being killed
Top Forums UNIX for Advanced & Expert Users ls is being killed Post 302169154 by bakunin on Wednesday 20th of February 2008 12:35:08 PM
Old 02-20-2008
Quote:
Originally Posted by darkrainbow
it is only 273 files inside the directory, what is the limit?
The problem is not a filesystem limit, the problem is a commandline limit: when you enter a command with a (shell-)variable or wildcard, like you entered "ls -l *sh" then the shell will expand the wildcard to all the filenames it is representing. Only then it will call the binary (ls in this case) and feed it whatever the wildcard has expanded to.

Example:

Code:
# ls -l
total 55
-rwxr-xr--   1 root     system        20455 Jan 08 12:03 a.sh
-rw-------   1 root     system         2527 Dec 08 2006  b.sh
-rwxr-xr--   1 root     system         5617 Feb 20 13:24 c.sh

We enter a command:

Code:
# ls -l *sh

Now, before giving the command to ls, the shell looks up what "*sh" represents and expands that to "a.sh b.sh c.sh". The command line now looks like:

Code:
# ls -l a.sh b.sh c.sh

Only now "ls" is called and fed the rest of the command line.

Alas, command lines cannot grow ad infinitum. POSIX has a limit of 4k characters and exactly this limit is exceeded in your case as the last value in your output of wc (the number of characters) shows. This is a pretty common gotcha in shell scripting and the common solution is to avoid constructions like that and use "find" instead. Your command above could be safely written this way:

Code:
find . -type f -name "*sh" -print | wc -l

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

process not getting killed

I have a process that is in the sleeping state "S" and I have tried to stop it with a run control script that I use to stop/start it - but it does not stop. I have tried kill -9 <PID of process> with no change. I imagine that this process is sleeping with the kernel. It does not respond to... (5 Replies)
Discussion started by: finster
5 Replies

2. UNIX for Dummies Questions & Answers

I'm getting killed and I don't know why.

UPDATE: I think I may have a culprit. I had KDE console history to unlimited, and since there's a lot of output... I'm thinking that may be it. I'd still like to hear advice on how to figure out why processes get killed, if anyone has any! though ****************** There's this script I run... (1 Reply)
Discussion started by: tphyahoo
1 Replies

3. Solaris

Port used needs to be killed

Hi, We are using oracle 10g in a Solaris box. The same box has Informatica also installed. But it runs on port 6001. But whenever the server is restarted the Oracle database picks up the port 6001 and does not allow Informatica to be started. But I am have no clue of which Oracle process is... (2 Replies)
Discussion started by: chrisanto_2000
2 Replies

4. UNIX for Advanced & Expert Users

Getting 'Killed' msg

Can anyone explain? I start my unix session on AIX, run tcsh move to a particular directory, let say: cd /test/bin and next i run a command like: grep "test string" /test/bin/* to look for the string in any files in the directory. I am getting a response of Killed. Why is that... (16 Replies)
Discussion started by: gio001
16 Replies

5. Shell Programming and Scripting

Killed by signal 15.

Hi all I have Master script, Main script ,and 4 Child script. Master.sh #!/bin/bash /export/home/user/Main.shMain.sh #!/bin/bash /export/home/user/Child1.sh & /export/home/user/Child2.sh & /export/home/user/Child3.sh & /export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies

6. Solaris

how to run a killed process

hi, i am creating a daemon process for updating the file at regular interval.one problem with this is if anybody kills the daemon it wont update the file.anybody have idea how to rerun the daemon if it killed.the code is written in c++ in solaries environment. thnaks & regards suresh (8 Replies)
Discussion started by: suresh_rtp
8 Replies

7. Shell Programming and Scripting

command to use if someone killed the script in between?

Hi All, I want to know about what command i can use so that it should run the below mentioned line if somebody killed the process when i run my script... the command to run once my script is killed is \rm -rf $LOCKDIR Thank you (2 Replies)
Discussion started by: smarty86
2 Replies

8. Shell Programming and Scripting

Syncsort is getting killed

Hi All, I am running synsort utility via unix scripts. As soon as the control reaches the syncsort command,Its getting killed. The error message is /proj/cdw/syncsort/dev/copay/CdwWkRvrslFileReformat.syn: 8339696 Killed . Please suggest to overcome this issue. (5 Replies)
Discussion started by: prashantnandi
5 Replies

9. UNIX for Dummies Questions & Answers

Process Killed : Need to find why ?

Hi reader, I'm making a tool out of korn shell script that is running on a HP-UX server. But everytime i invoke the tool, it gets killed after a while (mid-process). I have tried re-running it a couple of times but each invocation ending up the same way .. following is a snippet of the o/p... (8 Replies)
Discussion started by: clakkad
8 Replies

10. What is on Your Mind?

Has Oracle killed HP-UX

Has Oracle killed HP-UX with their gambit of telling the public they would no longer support Itanium? The company I work for in the Dallas, TX area has had several openings for HP-UX administrators and we're having such a tough time finding qualified people to fill them. I have been searching job... (3 Replies)
Discussion started by: keelba
3 Replies
MIWM(1) 						      General Commands Manual							   MIWM(1)

NAME
miwm - a minimal appearance, full-function window manager SYNOPSIS
miwm DESCRIPTION
MIWM is Ben Wise's MInimal Window Manager. It is pronounced 'my whim'. The goal of miwm is to be a fully functional window manager, while retaining a very spare (Zen or Spartan, as you please) appearance and command-set. WARNING
This man page is VERY MUCH under construction. It is not complete, and blatantly contains leftover pieces of the man page I used as a tem- plate. Do not rely on anything you find here. COMMANDS
The notation for describing commands is that Mouse-1-frame means 'button 1 click on frame', C-Mouse-3-root means 'control button 3 click on root', Mouse-1-frame Raise. Mouse-2-frame Move. Mouse-2-root Select virtual workspace. Mouse-3-frame Hide. Filenames passed to miwm can be directories or deleted files. If a directory that is not deleted is passed to miwm, then the deleted files or directo- ries in it will be restored; if the recursive option is specified, then all deleted files or directories in any of its children will be restored as well. The shell wildcards * and ?, as well as shell brace notation using [ and ], are interpreted correctly by miwm. It is possible to pass wildcards to the program without the wildcards being intercepted by the shell by setting noglob (in csh) or by quoting the wildcards. To delete a file that actually has a wildcard in its name, you must precede the quoted wildcard with a quoted backslash. If no files are specified on the command line, miwm goes into interactive mode. In interactive mode, the user is prompted to enter files to be restored, one file per line. Typing a carriage return on an empty prompt line exits the program. Wildcards and quoting backslashes can be entered directly at the prompt without any shell interference (which is the main reason there is an interactive mode). OPTIONS
Miwm No command-line options. KNOWN BUGS
The code is too complicated. No icon support. SEE ALSO
9wm(1), aewm(1) AUTHOR
Ben Paul Wise RESTRICTIONS
Copyright (c) 1998-2003 by Ben Paul Wise. All rights reserved. MIWM(1) specifies the terms and conditions for redistribution. Ben Paul Wise 06 May 2003 MIWM(1)
All times are GMT -4. The time now is 06:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy