13,005
回編集
(→if文) |
(→if文) |
||
44行目: | 44行目: | ||
以下の例では、foo.txtファイルが通常のファイルで読み取り可能な場合、<u>foo.txt exists and is readable</u>と表示している。<br> | 以下の例では、foo.txtファイルが通常のファイルで読み取り可能な場合、<u>foo.txt exists and is readable</u>と表示している。<br> | ||
<syntaxhighlight lang="fish"> | <syntaxhighlight lang="fish"> | ||
if [ -f foo.txt ] and [ -r foo.txt ] | if [ -f foo.txt ]; and [ -r foo.txt ] | ||
echo "foo.txt exists and is readable" | echo "foo.txt exists and is readable" | ||
end | end | ||
# []コマンドではなく、testコマンドを使用する場合 | # []コマンドではなく、testコマンドを使用する場合 | ||
if test -f foo.txt and test -r foo.txt | if test -f foo.txt; and test -r foo.txt | ||
echo "foo.txt exists and is readable" | echo "foo.txt exists and is readable" | ||
end | end |