2
I have a rather strict set of specs for a directory listing that I need:
- It must list the directories in the current directory
- It must list purely the basename (no "./", no trailing slash)
- It mustn't error if there are none (and mustn't print an error to std{out,err})
- It must be very lightweight
- It must work under tcsh
I've got something working like this:
find -maxdepth 1 -mindepth 1 -type d -printf '%f\n'
But I can't help feeling that using "find" is overkill. I tried to do something with ls -d */
, but I couldn't figure out how to get it not error (or appear to not error).
Any suggestions?
How do you need the output? ls-style or one per line? – Dennis – 2013-03-26T14:32:28.423
This is for a tcsh completion, which I think means either will work (I can't use the standard directory completion, for reasons I won't go into right now). – spookypeanut – 2013-03-26T16:48:38.323