shithub: x

Download patch

ref: 793c71959acb38e08f9554189da1cb38e66af86d
parent: 989dbedde74719cbb6c2d85316325b7db7621118
author: Romano <[email protected]>
date: Thu Jun 27 13:02:34 EDT 2024

fix x/path -l

--- a/path
+++ b/path
@@ -10,18 +10,23 @@
 if not
 	wd=`{pwd}
 wd=`{cleanname $wd}
-if(! ~ $wd /x/*)
-	exit 'invalid path'
 for(arg){
 	switch($arg){
 	case -P
-		echo $wd | sed 's,/[^/]+/[^/]+(.*),\1,'
+		sed='s,/[^/]+/[^/]+(.*),\1,'
 	case -p
-		echo $wd | sed 's,/[^/]+/[^/]+/(.*),\1,'
+		sed='s,/[^/]+/[^/]+/(.*),\1,'
 	case -r
-		echo $wd | sed 's,(/[^/]+/[^/]+).*,\1,'
+		sed='s,(/[^/]+/[^/]+).*,\1,'
 	case -l
+		sed=()
 		echo $wd | awk -F/ '{if($3) print $3; else print $0}'
 	}
 	shift
+}
+if(! ~ $sed ''){
+	if(! ~ $wd /x/*)
+		exit 'invalid path'
+	if not
+		echo $wd | sed $"sed
 }