<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>fuji_haruka</author_name>
  <author_url>https://blog.hatena.ne.jp/fuji_haruka/</author_url>
  <blog_title>Fuji Haruka's blog</blog_title>
  <blog_url>https://hfuji.hatenablog.jp/</blog_url>
  <categories>
  </categories>
  <description>後輩から教わったTips。 $ echo foo ↑これの「$」の色を前のコマンドの終了コードが0以外だったら赤色表示にしたい。 $ false $ # ↑$を赤くする Mac のターミナルを使っているので .bash_profile を編集して変数 PS1 をいじる。 RETURN_CODE_DOLLAR='$([ $? -eq 0 ] &amp;&amp; echo -en \[\e[37m\] || echo -en \[\e[31m\])\$\[\e[37m\]' PS1=&quot;${RETURN_CODE_DOLLAR} &quot; これでよろしい。PS1の中で $()を使って色を埋め込む。 ついでにカレントディ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhfuji.hatenablog.jp%2Fentry%2F2019%2F02%2F27%2F190507&quot; title=&quot;プロンプトの$を終了コードによって色変更する - Fuji Haruka&amp;#39;s blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/f/fuji_haruka/20190227/20190227190428.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-02-27 19:05:07</published>
  <title>プロンプトの$を終了コードによって色変更する</title>
  <type>rich</type>
  <url>https://hfuji.hatenablog.jp/entry/2019/02/27/190507</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
