ref: 15fa021ec186990c81f4e3b4ca68deb6426074f5
parent: 70cc21bcb5179d02b5f4d2adf3e5d3b6ce1d0830
author: kvik <[email protected]>
date: Sun Jun 23 08:19:59 EDT 2019
x/path: accept pathname as last argument
--- a/path
+++ b/path
@@ -1,11 +1,14 @@
#!/bin/rc
# x/path -- extract datums from the path
rfork e
-wd=`{pwd}
+if(! ~ $$#* -*)
+ wd=$$#*
+if not
+ wd=`{pwd}
if(! ~ $wd /x/*)
exit notinx
-while(! ~ $#1 0 && ~ $1 -*){
- switch($1){
+for(arg){
+ switch($arg){
case -P
echo $wd | sed 's,/x/[^/]+(.*),\1,'
case -p