TEST(1) | 使用者命令 | TEST(1) |
test - 檢查檔案型別並比較值
test 表示式
test
[ 表示式 ]
[ ]"
[ 選項
退出狀態值取決於表示式。
表示式被省略,則預設為假。否則,表示式可能為真或假,且以此設定返回狀態。可能出現的情況如下所示:
除了 -h 和 -L,所有與指定檔案相關的測試都跟隨符號連結。請注意在 shell 中圓括號需要被轉義(例如,使用反斜線)。也可以把“-l 字串”作為指定整數,其值為該字串的長度。
注:二元運算子 -a 和 -o 存在固有的歧義問題。請使用 "test EXPR1 &&test EXPR2" 或 "test EXPR1 || test EXPR2" 作為替代。
註記:[ 接受 --help 和 --version 選項,但是 test 並非如此。test 將它們與其它非空字元串同等看待。
注意:您的 shell 可能內建了自己的 test 和/或 [ 程式版本,它會覆蓋這裡所提及的相應版本。請查閱您的 shell 文件獲知它所支援的選項。
由 Kevin Braunsdorf 和 Matthew Bradburn 編寫。
GNU coreutils 的線上幫助:
<https://www.gnu.org/software/coreutils/>
請向 <https://translationproject.org/team/zh_CN.html>
報告翻譯錯誤。
Copyright © 2022 Free Software Foundation, Inc. License
GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
access(2)
完整文件請見:
<https://www.gnu.org/software/coreutils/test[>
或者在本地使用: info
'(coreutils) test invocation'
本頁面中文版由中文
man 手冊頁計劃提供。
中文 man
手冊頁計劃:https://github.com/man-pages-zh/manpages-zh
2022年9月 | GNU coreutils 9.1 |