snipt

Ctrl+h for KB shortcuts

Bash

txt2html sed

Snipt has been removed. Please contact [email protected]
https://snipt.net/embed/96d01b803571284855b5a047a70cc54e/
/raw/96d01b803571284855b5a047a70cc54e/
96d01b803571284855b5a047a70cc54e
bash
Bash
1
2019-05-24T06:42:58
True
False
False
/api/public/snipt/10751/
txt2html-sed-1
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Snipt has been removed. Please contact [email protected] </span></pre></div> </td></tr></table>
bash, linux, sed

Bash

txt2html sed

Snipt has been removed. Please contact [email protected]
https://snipt.net/embed/bdd68a5465b63e26de29e217bd5150e6/
/raw/bdd68a5465b63e26de29e217bd5150e6/
bdd68a5465b63e26de29e217bd5150e6
bash
Bash
1
2019-05-22T14:59:24
True
False
False
/api/public/snipt/10750/
txt2html-sed
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Snipt has been removed. Please contact [email protected] </span></pre></div> </td></tr></table>
bash, linux, sed

Bash

fix /etc/hosts in ubuntu

1
2
3
4
5
6
7
8
# faça login como root
# este comando conserta o arquivo /etc/hosts, que no ubuntu deve conter na 
# primeira linha o hostname

fixetchosts () {
[ "`awk 'NR==1 {print $NF}' /etc/hosts`" == "`hostname`" ] || \
sed -i "1s/\(.*\)/\1 `hostname`/g" /etc/hosts
} && fixetchosts
https://snipt.net/embed/540b288c2700f7824ce3d8dcc76af33f/
/raw/540b288c2700f7824ce3d8dcc76af33f/
540b288c2700f7824ce3d8dcc76af33f
bash
Bash
8
2019-05-25T06:38:26
True
False
False
/api/public/snipt/8751/
fix-etchosts-in-ubuntu
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># faça login como root</span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># este comando conserta o arquivo /etc/hosts, que no ubuntu deve conter na </span> </span><span id="L-3"><a name="L-3"></a><span class="c1"># primeira linha o hostname</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>fixetchosts <span class="o">()</span> <span class="o">{</span> </span><span id="L-6"><a name="L-6"></a><span class="o">[</span> <span class="s2">&quot;`awk &#39;NR==1 {print </span><span class="nv">$NF</span><span class="s2">}&#39; /etc/hosts`&quot;</span> <span class="o">==</span> <span class="s2">&quot;`hostname`&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="se">\</span> </span><span id="L-7"><a name="L-7"></a>sed -i <span class="s2">&quot;1s/\(.*\)/\1 `hostname`/g&quot;</span> /etc/hosts </span><span id="L-8"><a name="L-8"></a><span class="o">}</span> <span class="o">&amp;&amp;</span> fixetchosts </span></pre></div> </td></tr></table>
bash, sed