-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathlf.sh
More file actions
32 lines (28 loc) · 680 Bytes
/
lf.sh
File metadata and controls
32 lines (28 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
# just a Bourne POSIX shell script to list directories or files in the given path
#
Usage () {
while read -r CurLine; do
printf '%b\n' "$CurLine"
done <<-EOF
\r#Usage:
\r lf <d/f/L/p/S/b> <PATH Optional>
\r d For Directories
\r f For Files
\r L For Symbolic Links
\r p For Named Pipes
\r S For Sockets
\r b For Block Special Files
EOF
}
case $1 in
[fdLpSb]) Type=$1 ;;
*) Usage; exit 1 ;;
esac
for CurFile in ${2:-.}/.* ${2:-.}/* ; do
case $CurFile in
.|..|*/.|*/..) continue ;;
esac
[ -$Type "$CurFile" ] && printf '%s\n' "${CurFile#./}"
done