ref: 1a2e3adfccf834e80453813fdb4716a3e8853210
author: kvik <[email protected]>
date: Fri Jun 21 06:38:46 EDT 2019
init, add x/path
--- /dev/null
+++ b/path
@@ -1,0 +1,19 @@
+#!/bin/rc
+# x/path -- extract datums from the path
+rfork e
+wd=`{pwd}
+if(! ~ $wd /x/*)
+ exit notinx
+while(! ~ $#1 0 && ~ $1 -*){
+ switch($1){
+ case -P
+ echo $wd | sed 's,/x/[^/]+(.*),\1,'
+ case -p
+ echo $wd | sed 's,/x/[^/]+/(.*),\1,'
+ case -r
+ echo $wd | sed 's,(/x/[^/]+).*,\1,'
+ case -l
+ echo $wd | awk -F/ '{print $3}'
+ }
+ shift
+}