aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-21 14:48:13 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-21 14:48:13 +1200
commitbf86a2f939651b691a2ee814de7853424455c813 (patch)
tree29febe40833f4c1af6741c77bec01e5ce920233e
parentc2f05c595dfe71a60f48e14635af191c07bf6980 (diff)
downloaddotfiles-bf86a2f939651b691a2ee814de7853424455c813.tar.gz
dotfiles-bf86a2f939651b691a2ee814de7853424455c813.zip
Add la(), ll()
-rw-r--r--README.markdown2
-rw-r--r--sh/profile.d/ls.sh3
-rw-r--r--sh/shrc.d/la.sh10
-rw-r--r--sh/shrc.d/ll.sh10
4 files changed, 24 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index e17ddb68..cb6ef74e 100644
--- a/README.markdown
+++ b/README.markdown
@@ -184,6 +184,8 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include:
* `ls()` tries to apply color to `ls(1)` for interactive use if available.
It's dependent on information written by the `ls.sh` script in
`~/.profile.d`.
+ * `la()` runs `ls -A` if it can, or `ls -a` otherwise.
+ * `ll()` runs `ls -Al` if it can, or `ls -al` otherwise.
* `mkcd()` creates a directory and changes into it.
* `mysql()` allows shortcuts to MySQL configuration files stored in
`~/.mysql`.
diff --git a/sh/profile.d/ls.sh b/sh/profile.d/ls.sh
index 8a255bee..2b0f507d 100644
--- a/sh/profile.d/ls.sh
+++ b/sh/profile.d/ls.sh
@@ -13,7 +13,8 @@
# Iterate through some useful options and create files to show they're
# available
- set -- block-size \
+ set -- almost-all \
+ block-size \
classify \
color \
human-readable \
diff --git a/sh/shrc.d/la.sh b/sh/shrc.d/la.sh
new file mode 100644
index 00000000..e21ad8fb
--- /dev/null
+++ b/sh/shrc.d/la.sh
@@ -0,0 +1,10 @@
+# Run ls -A if we can (-A is not POSIX), ls -a otherwise
+la() {
+ # Prefer --almost-all (exclude "." and "..") if available
+ if [ -e "$HOME"/.cache/ls/almost-all ] ; then
+ set -- -A "$@"
+ else
+ set -- -a "$@"
+ fi
+ ls "$@"
+}
diff --git a/sh/shrc.d/ll.sh b/sh/shrc.d/ll.sh
new file mode 100644
index 00000000..c8c95d3b
--- /dev/null
+++ b/sh/shrc.d/ll.sh
@@ -0,0 +1,10 @@
+# Run ls -Al if we can (-A is not POSIX), ls -al otherwise
+ll() {
+ # Prefer -A/--almost-all (exclude "." and "..") if available
+ if [ -e "$HOME"/.cache/ls/almost-all ] ; then
+ set -- -Al "$@"
+ else
+ set -- -al "$@"
+ fi
+ ls "$@"
+}