#!/bin/bash # # List just the subdirectories in the current # directory or in a specified directory. # # This edition is being developed on XP/Cygwin specifically to deal # with directory names with embedded spaces and apostrophes, with # the intention that it will work unchanged on Linux as well. # # We know that we "have an issue" with a few hidden files in the XP # root file system, namely, 'hiberfil.sys' and 'pagefile.sys', but # for now we are going to just let the 'file' error messages appear, # so we don't have to think any more about them. # OK=0 if [ $# -eq 0 ] ; then OK=1 elif [ $# -eq 1 ] ; then if [ -d $1 ] ; then OK=1 cd $1 fi fi if [ $OK == 1 ] ; then # find . -maxdepth 1 -type d ! -name "." -printf "%f\n" | gawk ' \ #{ # printf "\"%s\"\n", $0; #} ' |xargs ls -dACF find . -maxdepth 1 -type d ! -name "." -printf "\"%f\"\n" | xargs ls -dACF exit 0 fi echo "ddir: list just the subdirectories in the current" echo " directory or in a specified directory." echo "Usage: \"ddir [directory]\"" exit 1