#!/bin/bash
function listdir {
local PAT="$1"
local ROOT="$2"
for i in *; do
if [ -d "$i" ]; then
local CUR="$ROOT/$i"
pushd "$i" &>/dev/null
listdir "$PAT" "$CUR"
popd &>/dev/null
fi
done
if [ ! -z "$( ls -d $PAT 2>/dev/null )" ]; then
echo "Directory: $ROOT"
ls -d $PAT 2>/dev/null
echo
fi
}
if [ -z "$1" ]; then
echo List file in PATTERN recursive into directories.
echo Usage: $0 "PATTERN"
exit
fi
PATTERN="$1"
echo "List $PATTERN"
listdir "$PATTERN" "."
#!/bin/bash
OPTIONS="Hello Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "Hello" ]; then
echo Hello World
else
clear
echo bad option
fi
done
Recent comments