summaryrefslogtreecommitdiff
path: root/doc/elglob.html
blob: e9e73b101ab1927f68fe98577cd27f2704bebedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <meta http-equiv="Content-Language" content="en" />
 <title>execline: the elglob command</title>
 <meta name="Description" content="execline: the elglob command" />
 <meta name="Keywords" content="execline command elglob pattern shell globbing" />
 <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
</head>
<body>

<p>
<a href="index.html">execline</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>elglob</tt> program </h1>

<p>
<tt>elglob</tt> performs globbing on a pattern, then executes
another program.
</p>

<h2> Interface </h2>

<pre>
     elglob [ -v ] [ -w ] [ -s ] [ -m ] [ -e ] [ -0 ] [ -n ] [ -d <em>delim</em> ] <em>variable</em> <em>pattern</em> <em>prog...</em>
</pre>

<ul>
 <li> <tt>elglob</tt> performs
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html">globbing</a>
on <em>pattern</em>. </li>
 <li> It then performs
<a href="el_substitute.html">variable substitution</a> on
<em>prog...</em>, using <em>variable</em> as key and the result of the
globbing as value. The value is always split: it contains as many words
as they are matches for the globbing pattern. </li>
 <li> <tt>elglob</tt> then execs into the modified <em>prog...</em>. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-v</tt>&nbsp;: verbose. If there is a problem while globbing, print
a warning message on stderr. </li>
 <li> <tt>-w</tt>&nbsp;: strict. If there is a problem while globbing, die
immediately. This is harsh - you probably don't need that option. </li>
 <li> <tt>-s</tt>&nbsp;: sort the matches. By default, the results are
left unsorted. </li>
 <li> <tt>-m</tt>&nbsp;: mark. Append a slash to each word that corresponds
to a directory. </li>
 <li> <tt>-e</tt>&nbsp;: no escape. Treat backslashes in <em>pattern</em>
literally; do not allow quoting of metacharacters in <em>pattern</em> via
backslashes. <strong>Warning</strong>: the
<a href="execlineb.html">execlineb</a> launcher
uses the backslash as their own escape character - if you want a
backslash to be passed to <tt>elglob</tt>, do not forget to <em>double</em>
it. </li>
 <li> <tt>-0</tt>&nbsp;: null globbing. By default, if <em>pattern</em>
matches nothing, it will be substituted as is (verbatim in one word). With
this option, if <em>pattern</em> matches nothing, it will be properly
substituted as zero word. </li>
 <li> <tt>-n</tt>&nbsp;: chomp. Don't add an ending delimiter at the end
of the word. Only valid with the <tt>-d</tt> option, see below. </li>
 <li> <tt>-d&nbsp;<em>delim</em></tt>&nbsp;: do not split the value.
Instead, make it one word, where the result of the globbing are separated
by the first character of <em>delim</em>. If the <tt>-n</tt> option is
not given, the first character of <em>delim</em> also appears after the
last result. If <em>delim</em> is the empty string, the values are
encoded as a sequence of netstrings into a single word, (and you can
later separate the words with e.g.
<a href="define.html">define -s</a>). </li>
</ul>

</body>
</html>