aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 "$@"
+}