@@ 1,2 1,16 @@
#!/bin/sh
-ls -a | grep '^\.' | egrep -v '^\.\.?$'
+
+# Print names of all hidden files
+# All names are quoted, the better to use them in other commands
+
+# Below, shell quoting and escaping is rather obscuring the regexes.
+# Sans shell quote fuckery, with all quotes part of the regex, they would look
+# like this:
+#
+# ls -a --quoting-style=shell-always\
+# | grep ^'\. # keep all names that start with a dot
+# | grep -v ^'\.\.\?'$ # remove '.' and '..'
+
+ls -a --quoting-style=shell-always \
+ | grep '^'\''\.' \
+ | grep -v "^'\\.\\.\\?'$"