shithub: x

Download patch

ref: 15a47f5bcfdb3a1059c3dcea51786ce1ac40abf4
parent: 3ac6e2fd1eebb648b80ee77723815d88d84476da
author: kvik <kvik@a-b.xyz>
date: Thu Sep 19 18:52:48 EDT 2019

x/run: enable passing flags to the shell

--- a/run
+++ b/run
@@ -1,8 +1,15 @@
 #!/bin/rc
 rfork e
+flags=()
+while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
+	flags=($flags $1)
+	shift
+}
+if(~ $1 --)
+	shift
 rpath=`{x/path -P}
 cmd=`{awk 'BEGIN{
-	printf("$SHELL -c ''cd %s; %s''",
-		ENVIRON["rpath"], ENVIRON["*"])
+	printf("$SHELL %s -c ''cd %s; %s''",
+		ENVIRON["flags"], ENVIRON["rpath"], ENVIRON["*"])
 }'}
 ssh `{x/path -l} $"cmd