aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-06 13:59:26 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-06 13:59:26 +1300
commit13d4998ee636abbb5bf1b20acd5b19ecd8af0578 (patch)
tree91c7be8c6a76d8653fdae8feec0357cb0d2d89ed /bin
parentAdd jfp(1df) (diff)
downloaddotfiles-13d4998ee636abbb5bf1b20acd5b19ecd8af0578.tar.gz
dotfiles-13d4998ee636abbb5bf1b20acd5b19ecd8af0578.zip
Add pp(1df) and pph(1df)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pp14
-rwxr-xr-xbin/pph5
2 files changed, 19 insertions, 0 deletions
diff --git a/bin/pp b/bin/pp
new file mode 100755
index 00000000..d9e45f92
--- /dev/null
+++ b/bin/pp
@@ -0,0 +1,14 @@
+#!/bin/sh
+# Print the full path to each argument; file need not exist
+for arg ; do
+ case $arg in
+ */*)
+ dir=$(cd -- "${arg%/*}" ; printf '%s/' "$PWD")
+ dir=${dir%/}
+ ;;
+ *)
+ dir=$PWD
+ ;;
+ esac
+ printf '%s/%s\n' "$dir" "${arg##*/}"
+done
diff --git a/bin/pph b/bin/pph
new file mode 100755
index 00000000..684aaafd
--- /dev/null
+++ b/bin/pph
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Run pp(1df) on args, prefix with machine hostname
+hostname=$(hostname -s) || exit
+pp "$@" |
+sed 's_^_'"$hostname":'_'