вам нужна страница TLDP для BASH,
расширенный bash: http://www.tldp.org/LDP/abs/html/index.html
bash для начинающих: http://tldp.org/LDP/Bash-Beginners -Guide / html / index.html
то, что вы спрашивали, касается операторов проверки файлов , и его можно найти здесь: http://www.tldp.org/LDP/abs/html /fto.html
, а также условные выражения bash , которые можно найти здесь: http://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions. html
-d file is a directory
-f file is a regular file
-e file exists
-s file size is not zero
-b file is a block device
-h file is a symbolic link
-w file has write permissions for user executing this bash statement
{there are more}
#!/bin/bash
if [ -e $1 ] && [ -w $1 ]; then
echo "the file you entered was "$1" and it exists and you have write permission to it"
else
echo "condition failed for exist and for write permission"
fi