📢 Webサイト閉鎖と移転のお知らせ
このWebサイトは2026年9月に閉鎖いたします。
新しい記事は移転先で追加しております。(旧サイトでは記事を追加しておりません)
| 39行目: | 39行目: | ||
else | else | ||
echo "foo.txt and bar.txt do not exist" | echo "foo.txt and bar.txt do not exist" | ||
end | |||
</syntaxhighlight> | |||
<br> | |||
以下の例では、foo.txtファイルが通常のファイルで読み取り可能な場合、<u>foo.txt exists and is readable</u>と表示している。<br> | |||
<syntaxhighlight lang="fish"> | |||
if [ -f foo.txt ] and [ -r foo.txt ] | |||
echo "foo.txt exists and is readable" | |||
end | |||
# []コマンドではなく、testコマンドを使用する場合 | |||
if test -f foo.txt and test -r foo.txt | |||
echo "foo.txt exists and is readable" | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||