You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
473 B
30 lines
473 B
#!/bin/sh
|
|
|
|
if ! test -d "$1"; then
|
|
echo 'Usage: dir dirname'
|
|
exit 1
|
|
fi
|
|
|
|
colors=$(tput colors)
|
|
dir_color=''
|
|
exe_color=''
|
|
ln_color=''
|
|
if test -n "$colors"; then
|
|
dir_color='\e[34m'
|
|
exe_color='\e[32m'
|
|
ln_color='\e[36m'
|
|
fi
|
|
|
|
for file in "$1"/*; do
|
|
if test -d "$file"; then
|
|
echo "$dir_color[$file]\e[0m"
|
|
elif test -x "$file"; then
|
|
echo "$exe_color*$file\e[0m"
|
|
elif test -h "$file"; then
|
|
echo "$ln_color*$file\e[0m"
|
|
else
|
|
echo "$file"
|
|
fi
|
|
done
|
|
|