|
|
@ -1,6 +1,8 @@
|
|
1
|
1
|
#!/usr/bin/env bash
|
|
2
|
2
|
|
|
3
|
|
# ls or less anything in your filesystem (depending on what it is).
|
|
|
3
|
# ls or less anything in your filesystem or on the web (depending on what it is).
|
|
|
4
|
|
|
|
5
|
url_pattern="https?://.*"
|
|
4
|
6
|
|
|
5
|
7
|
if [ -d "$1" ]; then
|
|
6
|
8
|
ls --group-directories-first --color=auto "$1"
|
|
|
@ -8,6 +10,8 @@ elif [ -f "$1" ]; then
|
|
8
|
10
|
less "$1"
|
|
9
|
11
|
elif which "$1" &> /dev/null; then
|
|
10
|
12
|
less `which $1`
|
|
|
13
|
elif [[ "$1" =~ $url_pattern ]]; then
|
|
|
14
|
curl --silent --fail "$1" | less
|
|
11
|
15
|
else
|
|
12
|
16
|
ls --group-directories-first --color=auto $*
|
|
13
|
17
|
fi
|