Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like `rmdir` because I don't have to check if a directory that I think is empty is actually empty with `ls -la` before removing it. This happens a lot with moving stuff out of directories (sometimes to different destinations).


Even in that case, you can use "rm -d" instead of "rmdir".

  % mkdir herewulf
  % rm herewulf
  rm: herewulf: is a directory
  % rm -d herewulf
  %
  % mkdir herewulf
  % touch herewulf/nonempty.txt
  % 
  % rm herewulf/
  rm: herewulf/: is a directory
  % rm -d herewulf/
  rm: herewulf/: Directory not empty
  % rm herewulf/nonempty.txt
  % rm -d herewulf/
The only distinct feature of rmdir is that it won't remove things that aren't files:

  % touch herewulf
  % rm -d herewulf
  % touch herewulf
  % rmdir herewulf
  rmdir: herewulf: Not a directory
Is that "one thing well" really enough to justify its own tool?

Unix has always had a tension between "one thing well" and "one powerful tool".

Is 'cc' a preprocessor? A compiler? A linker? Yes!

Does 'date' show the current date (and time), set the system date, or convert between dates? Yes!


> Is 'cc' a preprocessor? A compiler? A linker? Yes!

It's none of them; it's a driver which calls the preprocessor (cpp), the real compiler, and the linker (ld).


The man pages call it a compiler:

  % man cc
    ...
  DESCRIPTION
       clang is a C, C++, and Objective-C compiler which encompasses
       preprocessing, parsing, optimization, code generation, assembly, and
       linking.

  % man gcc
  ...
  NAME
       gcc - GNU project C and C++ compiler
  ...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: