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-06-16T18:43:49
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-06-11T19:05:48
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

man pages color active

1
2
3
4
5
6
7
# manpages coloridas -- coloque no ~/.bashrc
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
https://snipt.net/embed/7e0dde87f6ce0be14ff1ebbe94771f36/
/raw/7e0dde87f6ce0be14ff1ebbe94771f36/
7e0dde87f6ce0be14ff1ebbe94771f36
bash
Bash
7
2019-06-11T17:16:02
True
False
False
/api/public/snipt/10730/
man-pages-color-active
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># manpages coloridas -- coloque no ~/.bashrc</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_mb</span><span class="o">=</span><span class="s1">$&#39;\E[01;31m&#39;</span> <span class="c1"># begin blinking</span> </span><span id="L-3"><a name="L-3"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_md</span><span class="o">=</span><span class="s1">$&#39;\E[01;38;5;74m&#39;</span> <span class="c1"># begin bold</span> </span><span id="L-4"><a name="L-4"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_me</span><span class="o">=</span><span class="s1">$&#39;\E[0m&#39;</span> <span class="c1"># end mode</span> </span><span id="L-5"><a name="L-5"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_se</span><span class="o">=</span><span class="s1">$&#39;\E[0m&#39;</span> <span class="c1"># end standout-mode</span> </span><span id="L-6"><a name="L-6"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_so</span><span class="o">=</span><span class="s1">$&#39;\E[38;5;246m&#39;</span> <span class="c1"># begin standout-mode - info box export LESS_TERMCAP_ue=$&#39;\E[0m&#39; # end underline</span> </span><span id="L-7"><a name="L-7"></a><span class="nb">export</span> <span class="nv">LESS_TERMCAP_us</span><span class="o">=</span><span class="s1">$&#39;\E[04;38;5;146m&#39;</span> <span class="c1"># begin underline</span> </span></pre></div> </td></tr></table>
bash

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-06-14T23:53:22
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

Bash

bash month test

1
2
3
4
[ `date --date='next day' +'%B'` == `date +'%B'` ] || echo 'fim do mês'

# o trecho antes da dupla igualdade retorna o mês do dia de amanhã,
# já o trecho após a dupla igualdade retorna o mês do dia de hoje, caso # # sejam diferentes o bash avisa que você está no fim do mês. 
https://snipt.net/embed/3454d9885b2f554e4a687bd33efe4cf7/
/raw/3454d9885b2f554e4a687bd33efe4cf7/
3454d9885b2f554e4a687bd33efe4cf7
bash
Bash
6
2019-06-17T03:36:37
True
False
False
/api/public/snipt/8626/
bash-month-test
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="o">[</span> <span class="sb">`</span>date --date<span class="o">=</span><span class="s1">&#39;next day&#39;</span> +<span class="s1">&#39;%B&#39;</span><span class="sb">`</span> <span class="o">==</span> <span class="sb">`</span>date +<span class="s1">&#39;%B&#39;</span><span class="sb">`</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">echo</span> <span class="s1">&#39;fim do mês&#39;</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># o trecho antes da dupla igualdade retorna o mês do dia de amanhã,</span> </span><span id="L-4"><a name="L-4"></a><span class="c1"># já o trecho após a dupla igualdade retorna o mês do dia de hoje, caso # # sejam diferentes o bash avisa que você está no fim do mês. </span> </span></pre></div> </td></tr></table>
bash, date