News for hackers. Stuff that matters.
Re:Why "ls *.c" is at least dumb, and possibly dangerous by yan on Thursday October 08, 2009 @10:37PM (#870486)
1) Just the system call overhead is not much compared to what the system call actually does, so it depends on what you're calling. Two system calls versus one with identically-cached information, sure it's slower. I'm just saying perl will also probably stat() and if not perl, the unlink() system call would perform the same function. When you're modifying files and flushing it to a drive, especially while using the shell interactively, the sys call overhead is completely negligible. All I'm trying to say is claiming the first command as inefficient is groundless; you execute it as a human and once -- it won't feel any slower.

2) If cleaning up after malicious users, sure why not. Doing this in your source tree or during normal usage? I don't know.

3) He mentioned ls stat()ing files as an inefficiency since the shell does it and ls does as well.

4)

  FIND(1)                   BSD General Commands Manual                  FIND(1)

  NAME
       find -- walk a file hierarchy
...

       -delete
             Delete found files and/or directories.  Always returns true.
             This executes from the current working directory as find recurses
Re:Why "ls *.c" is at least dumb, and possibly dangerous by blasdel on Friday October 09, 2009 @01:07AM (#870678)
Re:Why "ls *.c" is at least dumb, and possibly dangerous by vorador on Friday October 09, 2009 @03:26AM (#870800)
So what ? We're not in 1985. It's almost universally available, and perl too is not part of posix.