aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-06 14:27:03 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-06 14:28:51 +1300
commitac90f8e9a53600e00161df33b97ea5ddc5765e77 (patch)
tree4776a807c30d130fe9aa3574a25887ba7c92d841
parentAdd pp(1df) and pph(1df) (diff)
downloaddotfiles-ac90f8e9a53600e00161df33b97ea5ddc5765e77.tar.gz
dotfiles-ac90f8e9a53600e00161df33b97ea5ddc5765e77.zip
Simplify pp(1df)
-rwxr-xr-xbin/pp13
-rw-r--r--man/man1/pp.1df2
2 files changed, 6 insertions, 9 deletions
diff --git a/bin/pp b/bin/pp
index d9e45f92..d9fe6488 100755
--- a/bin/pp
+++ b/bin/pp
@@ -1,14 +1,9 @@
#!/bin/sh
-# Print the full path to each argument; file need not exist
+# Print the full path to each argument; path need not exist
for arg ; do
case $arg in
- */*)
- dir=$(cd -- "${arg%/*}" ; printf '%s/' "$PWD")
- dir=${dir%/}
- ;;
- *)
- dir=$PWD
- ;;
+ /*) path=$arg ;;
+ *) path=$PWD/$arg ;;
esac
- printf '%s/%s\n' "$dir" "${arg##*/}"
+ printf '%s\n' "$path"
done
diff --git a/man/man1/pp.1df b/man/man1/pp.1df
index 1c7aca70..322e7b48 100644
--- a/man/man1/pp.1df
+++ b/man/man1/pp.1df
@@ -9,6 +9,8 @@
.B pp
uses $PWD to print the full path to each of its arguments, unless they begin
with a slash, in which case they are printed verbatim.
+.P
+The path need not actually exist.
.SH CAVEATS
Newlines in filenames will still work, but the results won't really make sense
as they'll be indistinguishable from newlines separating the files. This is for