summaryrefslogtreecommitdiff
path: root/doc/tryexec.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tryexec.html')
-rw-r--r--doc/tryexec.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/doc/tryexec.html b/doc/tryexec.html
new file mode 100644
index 0000000..2fcc7b6
--- /dev/null
+++ b/doc/tryexec.html
@@ -0,0 +1,67 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>execline: the tryexec command</title>
+ <meta name="Description" content="execline: the tryexec command" />
+ <meta name="Keywords" content="execline command tryexec" />
+ <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">execline</a><br />
+<a href="http://skarnet.org/software/">Software</a><br />
+<a href="http://skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>tryexec</tt> program </h1>
+
+<p>
+<tt>tryexec</tt> executes into a command line, with a fallback.
+</p>
+
+<h2> Interface </h2>
+
+<p>
+ In an <a href="execlineb.html">execlineb</a> script:
+</p>
+
+<pre>
+ tryexec [ -n ] [ -c ] [ -l ] [ -a argv0 ] { <em>prog1...</em> } <em>prog2...</em>
+</pre>
+
+<ul>
+ <li> <tt>tryexec</tt> reads <em>prog1...</em> in a
+<a href="el_semicolon.html">block</a>. It then executes into it,
+completely forgetting <em>prog2...</em> </li>
+ <li> If for some reason the <tt>execve()</tt> fails - for instance,
+a non-executable <em>prog1</em> - then <tt>tryexec</tt> executes
+into <em>prog2...</em> instead. </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-n</tt>&nbsp;: reverse <em>prog1...</em> and <em>prog2...</em>'s
+role. The latter becomes the main execution path and the former becomes
+the fallback. </li>
+</ul>
+
+<p>
+ The <tt>-c</tt>, <tt>-l</tt> and <tt>-a</tt> options have the same
+semantics as with the <a href="exec.html">exec</a> program.
+</p>
+
+<h2> Notes </h2>
+
+<ul>
+ <li> <tt>tryexec <em>prog1...</em> "" <em>prog2...</em></tt> would be
+equivalent to
+<tt>sh -c 'exec <em>prog1...</em> || exec <em>prog2...</em>'</tt>, if
+such a shell construct existed. Unfortunately, the shell language does
+not offer that functionality. </li>
+</ul>
+
+</body>
+</html>