if [ -k file ]
then
echo "File has sticky bit set"
fi
if [ -n "$(find file -prune -perm /1000)" ]
then
echo "File has sticky bit set"
fi
test -k file
and [ -k file ]
are not
defined by POSIX. To ensure compatibility with all target systems, use
find
instead.
None. If you are targeting a shell that supports
test -k
, specify it in the shebang.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.