Skip to content

Commit f14a1bc

Browse files
committed
deploy: f0e8d44
1 parent ae84e6b commit f14a1bc

File tree

4 files changed

+232
-2
lines changed

4 files changed

+232
-2
lines changed

user/print.html

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8411,8 +8411,123 @@ <h2 id="examples-88"><a class="header" href="#examples-88">Examples</a></h2>
84118411
<div class="version">v0.0.18
84128412
</div>
84138413
</div>
8414+
<pre><code>test EXPRESSION
8415+
test
8416+
test EXPRESSION ]
8417+
test ]
8418+
test OPTION
8419+
</code></pre>
8420+
<p>Check file types and compare values.</p>
84148421
<h2 id="options-99"><a class="header" href="#options-99">Options</a></h2>
84158422
<dl></dl>
8423+
<p>Exit with the status determined by <code>EXPRESSION</code>.</p>
8424+
<p>An omitted <code>EXPRESSION</code> defaults to false.
8425+
Otherwise, <code>EXPRESSION</code> is true or false and sets exit status. </p>
8426+
<p>It is one of:</p>
8427+
<ul>
8428+
<li>( EXPRESSION ) <code>EXPRESSION</code> is true</li>
8429+
<li>! EXPRESSION <code>EXPRESSION</code> is false</li>
8430+
<li>EXPRESSION1 -a EXPRESSION2 both <code>EXPRESSION1</code> and <code>EXPRESSION2</code> are true</li>
8431+
<li>EXPRESSION1 -o EXPRESSION2 either <code>EXPRESSION1</code> or <code>EXPRESSION2</code> is true</li>
8432+
</ul>
8433+
<p>String operations:</p>
8434+
<ul>
8435+
<li>-n STRING the length of <code>STRING</code> is nonzero</li>
8436+
<li>STRING equivalent to -n <code>STRING</code></li>
8437+
<li>-z STRING the length of <code>STRING</code> is zero</li>
8438+
<li>STRING1 = STRING2 the strings are equal</li>
8439+
<li>STRING1 != STRING2 the strings are not equal</li>
8440+
</ul>
8441+
<p>Integer comparisons:</p>
8442+
<ul>
8443+
<li>INTEGER1 -eq INTEGER2 <code>INTEGER1</code> is equal to <code>INTEGER2</code></li>
8444+
<li>INTEGER1 -ge INTEGER2 <code>INTEGER1</code> is greater than or equal to <code>INTEGER2</code></li>
8445+
<li>INTEGER1 -gt INTEGER2 <code>INTEGER1</code> is greater than <code>INTEGER2</code></li>
8446+
<li>INTEGER1 -le INTEGER2 <code>INTEGER1</code> is less than or equal to <code>INTEGER2</code></li>
8447+
<li>INTEGER1 -lt INTEGER2 <code>INTEGER1</code> is less than <code>INTEGER2</code></li>
8448+
<li>INTEGER1 -ne INTEGER2 <code>INTEGER1</code> is not equal to <code>INTEGER2</code></li>
8449+
</ul>
8450+
<p>File operations:</p>
8451+
<ul>
8452+
<li>
8453+
<p>FILE1 -ef FILE2 <code>FILE1</code> and <code>FILE2</code> have the same device and inode numbers</p>
8454+
</li>
8455+
<li>
8456+
<p>FILE1 -nt FILE2 <code>FILE1</code> is newer (modification date) than <code>FILE2</code></p>
8457+
</li>
8458+
<li>
8459+
<p>FILE1 -ot FILE2 <code>FILE1</code> is older than <code>FILE2</code></p>
8460+
</li>
8461+
<li>
8462+
<p>-b FILE <code>FILE</code> exists and is block special</p>
8463+
</li>
8464+
<li>
8465+
<p>-c FILE <code>FILE</code> exists and is character special</p>
8466+
</li>
8467+
<li>
8468+
<p>-d FILE <code>FILE</code> exists and is a directory</p>
8469+
</li>
8470+
<li>
8471+
<p>-e FILE <code>FILE</code> exists</p>
8472+
</li>
8473+
<li>
8474+
<p>-f FILE <code>FILE</code> exists and is a regular file</p>
8475+
</li>
8476+
<li>
8477+
<p>-g FILE <code>FILE</code> exists and is set-group-ID</p>
8478+
</li>
8479+
<li>
8480+
<p>-G FILE <code>FILE</code> exists and is owned by the effective group ID</p>
8481+
</li>
8482+
<li>
8483+
<p>-h FILE <code>FILE</code> exists and is a symbolic link (same as -L)</p>
8484+
</li>
8485+
<li>
8486+
<p>-k FILE <code>FILE</code> exists and has its sticky bit set</p>
8487+
</li>
8488+
<li>
8489+
<p>-L FILE <code>FILE</code> exists and is a symbolic link (same as -h)</p>
8490+
</li>
8491+
<li>
8492+
<p>-N FILE <code>FILE</code> exists and has been modified since it was last read</p>
8493+
</li>
8494+
<li>
8495+
<p>-O FILE <code>FILE</code> exists and is owned by the effective user ID</p>
8496+
</li>
8497+
<li>
8498+
<p>-p FILE <code>FILE</code> exists and is a named pipe</p>
8499+
</li>
8500+
<li>
8501+
<p>-r FILE <code>FILE</code> exists and read permission is granted</p>
8502+
</li>
8503+
<li>
8504+
<p>-s FILE <code>FILE</code> exists and has a size greater than zero</p>
8505+
</li>
8506+
<li>
8507+
<p>-S FILE <code>FILE</code> exists and is a socket</p>
8508+
</li>
8509+
<li>
8510+
<p>-t FD <code>file</code> descriptor <code>FD</code> is opened on a terminal</p>
8511+
</li>
8512+
<li>
8513+
<p>-u FILE <code>FILE</code> exists and its set-user-ID bit is set</p>
8514+
</li>
8515+
<li>
8516+
<p>-w FILE <code>FILE</code> exists and write permission is granted</p>
8517+
</li>
8518+
<li>
8519+
<p>-x FILE <code>FILE</code> exists and execute (or search) permission is granted</p>
8520+
</li>
8521+
</ul>
8522+
<p>Except for <code>-h</code> and <code>-L</code>, all FILE-related tests dereference (follow) symbolic links.
8523+
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
8524+
<code>INTEGER</code> may also be -l <code>STRING</code>, which evaluates to the length of <code>STRING</code>.</p>
8525+
<p>NOTE: Binary <code>-a</code> and <code>-o</code> are inherently ambiguous.
8526+
Use <code>test EXPR1 &amp;&amp; test EXPR2</code> or <code>test EXPR1 || test EXPR2</code> instead.</p>
8527+
<p>NOTE: <code>[</code> honors the <code>--help</code> and <code>--version</code> options, but test does not.
8528+
test treats each of those as it treats any other nonempty <code>STRING</code>.</p>
8529+
<p>NOTE: your shell may have its own version of <code>test</code> and/or <code>[</code>, which usually supersedes the version described here.
8530+
Please refer to your shell's documentation for details about the options it supports.</p>
84168531
<h2 id="examples-89"><a class="header" href="#examples-89">Examples</a></h2>
84178532
<p>Test if a given variable is equal to a given string:</p>
84188533
<pre><code class="language-shell">test &quot;{{$MY_VAR}}&quot; == &quot;{{/bin/zsh}}&quot;

user/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

user/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

user/utils/test.html

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,123 @@ <h1 id="test"><a class="header" href="#test">test</a></h1>
179179
<div class="version">v0.0.18
180180
</div>
181181
</div>
182+
<pre><code>test EXPRESSION
183+
test
184+
test EXPRESSION ]
185+
test ]
186+
test OPTION
187+
</code></pre>
188+
<p>Check file types and compare values.</p>
182189
<h2 id="options"><a class="header" href="#options">Options</a></h2>
183190
<dl></dl>
191+
<p>Exit with the status determined by <code>EXPRESSION</code>.</p>
192+
<p>An omitted <code>EXPRESSION</code> defaults to false.
193+
Otherwise, <code>EXPRESSION</code> is true or false and sets exit status. </p>
194+
<p>It is one of:</p>
195+
<ul>
196+
<li>( EXPRESSION ) <code>EXPRESSION</code> is true</li>
197+
<li>! EXPRESSION <code>EXPRESSION</code> is false</li>
198+
<li>EXPRESSION1 -a EXPRESSION2 both <code>EXPRESSION1</code> and <code>EXPRESSION2</code> are true</li>
199+
<li>EXPRESSION1 -o EXPRESSION2 either <code>EXPRESSION1</code> or <code>EXPRESSION2</code> is true</li>
200+
</ul>
201+
<p>String operations:</p>
202+
<ul>
203+
<li>-n STRING the length of <code>STRING</code> is nonzero</li>
204+
<li>STRING equivalent to -n <code>STRING</code></li>
205+
<li>-z STRING the length of <code>STRING</code> is zero</li>
206+
<li>STRING1 = STRING2 the strings are equal</li>
207+
<li>STRING1 != STRING2 the strings are not equal</li>
208+
</ul>
209+
<p>Integer comparisons:</p>
210+
<ul>
211+
<li>INTEGER1 -eq INTEGER2 <code>INTEGER1</code> is equal to <code>INTEGER2</code></li>
212+
<li>INTEGER1 -ge INTEGER2 <code>INTEGER1</code> is greater than or equal to <code>INTEGER2</code></li>
213+
<li>INTEGER1 -gt INTEGER2 <code>INTEGER1</code> is greater than <code>INTEGER2</code></li>
214+
<li>INTEGER1 -le INTEGER2 <code>INTEGER1</code> is less than or equal to <code>INTEGER2</code></li>
215+
<li>INTEGER1 -lt INTEGER2 <code>INTEGER1</code> is less than <code>INTEGER2</code></li>
216+
<li>INTEGER1 -ne INTEGER2 <code>INTEGER1</code> is not equal to <code>INTEGER2</code></li>
217+
</ul>
218+
<p>File operations:</p>
219+
<ul>
220+
<li>
221+
<p>FILE1 -ef FILE2 <code>FILE1</code> and <code>FILE2</code> have the same device and inode numbers</p>
222+
</li>
223+
<li>
224+
<p>FILE1 -nt FILE2 <code>FILE1</code> is newer (modification date) than <code>FILE2</code></p>
225+
</li>
226+
<li>
227+
<p>FILE1 -ot FILE2 <code>FILE1</code> is older than <code>FILE2</code></p>
228+
</li>
229+
<li>
230+
<p>-b FILE <code>FILE</code> exists and is block special</p>
231+
</li>
232+
<li>
233+
<p>-c FILE <code>FILE</code> exists and is character special</p>
234+
</li>
235+
<li>
236+
<p>-d FILE <code>FILE</code> exists and is a directory</p>
237+
</li>
238+
<li>
239+
<p>-e FILE <code>FILE</code> exists</p>
240+
</li>
241+
<li>
242+
<p>-f FILE <code>FILE</code> exists and is a regular file</p>
243+
</li>
244+
<li>
245+
<p>-g FILE <code>FILE</code> exists and is set-group-ID</p>
246+
</li>
247+
<li>
248+
<p>-G FILE <code>FILE</code> exists and is owned by the effective group ID</p>
249+
</li>
250+
<li>
251+
<p>-h FILE <code>FILE</code> exists and is a symbolic link (same as -L)</p>
252+
</li>
253+
<li>
254+
<p>-k FILE <code>FILE</code> exists and has its sticky bit set</p>
255+
</li>
256+
<li>
257+
<p>-L FILE <code>FILE</code> exists and is a symbolic link (same as -h)</p>
258+
</li>
259+
<li>
260+
<p>-N FILE <code>FILE</code> exists and has been modified since it was last read</p>
261+
</li>
262+
<li>
263+
<p>-O FILE <code>FILE</code> exists and is owned by the effective user ID</p>
264+
</li>
265+
<li>
266+
<p>-p FILE <code>FILE</code> exists and is a named pipe</p>
267+
</li>
268+
<li>
269+
<p>-r FILE <code>FILE</code> exists and read permission is granted</p>
270+
</li>
271+
<li>
272+
<p>-s FILE <code>FILE</code> exists and has a size greater than zero</p>
273+
</li>
274+
<li>
275+
<p>-S FILE <code>FILE</code> exists and is a socket</p>
276+
</li>
277+
<li>
278+
<p>-t FD <code>file</code> descriptor <code>FD</code> is opened on a terminal</p>
279+
</li>
280+
<li>
281+
<p>-u FILE <code>FILE</code> exists and its set-user-ID bit is set</p>
282+
</li>
283+
<li>
284+
<p>-w FILE <code>FILE</code> exists and write permission is granted</p>
285+
</li>
286+
<li>
287+
<p>-x FILE <code>FILE</code> exists and execute (or search) permission is granted</p>
288+
</li>
289+
</ul>
290+
<p>Except for <code>-h</code> and <code>-L</code>, all FILE-related tests dereference (follow) symbolic links.
291+
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
292+
<code>INTEGER</code> may also be -l <code>STRING</code>, which evaluates to the length of <code>STRING</code>.</p>
293+
<p>NOTE: Binary <code>-a</code> and <code>-o</code> are inherently ambiguous.
294+
Use <code>test EXPR1 &amp;&amp; test EXPR2</code> or <code>test EXPR1 || test EXPR2</code> instead.</p>
295+
<p>NOTE: <code>[</code> honors the <code>--help</code> and <code>--version</code> options, but test does not.
296+
test treats each of those as it treats any other nonempty <code>STRING</code>.</p>
297+
<p>NOTE: your shell may have its own version of <code>test</code> and/or <code>[</code>, which usually supersedes the version described here.
298+
Please refer to your shell's documentation for details about the options it supports.</p>
184299
<h2 id="examples"><a class="header" href="#examples">Examples</a></h2>
185300
<p>Test if a given variable is equal to a given string:</p>
186301
<pre><code class="language-shell">test &quot;{{$MY_VAR}}&quot; == &quot;{{/bin/zsh}}&quot;

0 commit comments

Comments
 (0)