如何才能?查?案是否文字??

如何才能?查?案是否文字??

#!/bin/sh
#bundle:group files into distribution package
if [ ??????????? ]
then
     echo you are passing a text file
elif [ "$#" -gt "0" ]
then
     ...
else
     echo You have not provide any argument
fi

怎?在???????????中做condiction?      
引用:
如何才能�z查�n案是否文字�n?
什么东西?      
Unix/Linux 对 text file 和 binary file 没有明确的区别, 也不存在绝对有效的工具可以判断一个 file 是 text 或者 binary 的, 只能在一般意义上做出一些猜测. 比如, 可以利用 grep 的 -I 选项:
复制内容到剪贴板
代码:
[color=blue]-(user@host:tty)-(tmp)-
[3817 0] $ [/color]file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
[color=blue]-(user@host:tty)-(tmp)-
[3817 0] $ [/color]file foo.c
foo.c: ASCII C program text
[color=blue]-(user@host:tty)-(tmp)-
[3817 0] $ [/color]grep -Iq . a.out && echo "Text File" || echo "Binary File"
Binary File
[color=blue]-(user@host:tty)-(tmp)-
[3817 0] $ [/color]grep -Iq . foo.c && echo "Text File" || echo "Binary File"
Text File
[color=blue]-(user@host:tty)-(tmp)-
[3817 0] $ [/color]