<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>guitarrapc_tech</author_name>
  <author_url>https://blog.hatena.ne.jp/guitarrapc_tech/</author_url>
  <blog_title>tech.guitarrapc.cóm</blog_title>
  <blog_url>https://tech.guitarrapc.com/</blog_url>
  <categories>
    <anon>PowerShell</anon>
  </categories>
  <description>シェルスクリプトのワンライナーは色々PowerShellを扱うに当たって勉強になります。 Ruby内部でshを呼び出すときに、変数を用いずにファイルやディレクトリの存在を確認して条件判定をする方法が面白かったのでどうぞ。 -fと-dを利用する とりあえず実例で。 これは、~/ (ホームディレクトリ)にhoge.shファイル(拡張子.shの「ファイル」を一つ明示しなくてはいけない)存在する場合に、その*.shを~/binにcp (コピー)するワンライナーです。 if ~ testで直接ファイル有無を判定できる所が勉強になります。 if [ -f &quot;~/hoge.sh&quot; ]; then cp *.…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftech.guitarrapc.com%2Fentry%2F2013%2F06%2F05%2F210628&quot; title=&quot;BashでFileやDirecotryの存在を確認する - tech.guitarrapc.cóm&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2013-06-05 21:06:28</published>
  <title>BashでFileやDirecotryの存在を確認する</title>
  <type>rich</type>
  <url>https://tech.guitarrapc.com/entry/2013/06/05/210628</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
