<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><generator uri="https://gohugo.io/" version="0.101.0">Hugo</generator><title type="html">find on A Scripter's Notes</title><subtitle type="html">Emacs, scripting and anything text oriented.</subtitle><link href="https://scripter.co/categories/find/" rel="alternate" type="text/html" title="HTML"/><link href="https://scripter.co/categories/find/index.xml" rel="alternate" type="application/rss+xml" title="RSS"/><link href="https://scripter.co/categories/find/atom.xml" rel="self" type="application/atom+xml" title="Atom"/><link href="https://scripter.co/categories/find/jf2feed.json" rel="alternate" type="application/jf2feed+json" title="jf2feed"/><updated>2026-04-22T08:24:57-04:00</updated><author><name>Kaushal Modi</name><email>kaushal.modi@gmail.com</email></author><id>https://scripter.co/categories/find/</id><entry><title type="html">Escaping dollar signs in tcsh</title><link href="https://scripter.co/escaping-dollar-signs-in-tcsh/?utm_source=atom_feed" rel="alternate" type="text/html"/><id>https://scripter.co/escaping-dollar-signs-in-tcsh/</id><published>2014-03-06T16:12:56-05:00</published><updated>2014-03-06T16:12:56-05:00</updated><content type="html"><![CDATA[<p>I found how to escape a $ sign
in a regex expression in a tcsh alias. BUT it is UGLY!</p>
<p>I wanted to set an alias for a <code>find</code> command containing the <code>-regex</code>
switch. For simplicity I will use this example:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-tcsh" data-lang="tcsh"><span class="line"><span class="cl">find . -type f -regex <span class="s1">&#39;.*\.txt$&#39;</span>
</span></span></code></pre></div><p>This expression simply gives a list of all *.txt files in any
directory under the current path.</p>
<p>The above command works fine when running in the terminal, but when
saving that to a <code>tcsh</code> alias, that <code>$</code> needs to be escaped:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-tcsh" data-lang="tcsh"><span class="line"><span class="cl"><span class="nb">alias </span>findtxt <span class="s2">&#34;find . -type f -regex &#39;.*txt&#39;\&#34;\$&#34;</span><span class="s1">&#39;&#39;</span><span class="err">&#34;</span>
</span></span></code></pre></div><blockquote>
<p>A simple <code>$</code> has to be written as <code>'\&quot;\$&quot;'</code>!!!</p>
</blockquote>
<p>Granted that I will usually get the same result if I did <code>alias findtxt &quot;find . -type f -regex '.*txt'&quot;</code> instead. But this turned out
to be an interesting exercise on how to escape a <code>$</code>.</p>
<p><a href="https://stackoverflow.com/questions/3571743/csh-alias-with-perl-one-liner-evaluates-when-alias-is-created-and-not-when-alias">Reference</a></p>]]></content><category scheme="https://scripter.co/categories/tcsh" term="tcsh" label="tcsh"/><category scheme="https://scripter.co/categories/find" term="find" label="find"/><category scheme="https://scripter.co/categories/escaping" term="escaping" label="escaping"/><category scheme="https://scripter.co/categories/regex" term="regex" label="regex"/></entry></feed>