<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ls -0 &gt; &#x2F;dev&#x2F;null 2&gt;&amp;1]]></title><description><![CDATA[<p dir="auto">suppressing the error output (stderr) of the ls -0 command, redirect it to standard output (stdout), writing it to /dev/null thereby immediately discarding it.</p>
<p dir="auto">This technique is commonly used to tell whether a command exists, which you can use for handling different operating systems, automatically installing packages, downloading files, and most importantly defending your scripts and systems from unexpected exceptions.</p>
<p dir="auto">function cmd_exists() {<br />
command -v $1 &gt; /dev/null 2&gt;&amp;1<br />
}</p>
<h1>cmd_exists ls; echo $?</h1>
<h1>cmd_exists sl; echo $?</h1>
]]></description><link>http://an.forum.genostack.com/topic/71/ls-0-dev-null-2-1</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 09:20:01 GMT</lastBuildDate><atom:link href="http://an.forum.genostack.com/topic/71.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Aug 2020 07:08:26 GMT</pubDate><ttl>60</ttl></channel></rss>