Determine if a file is writable by a Bourne script user

Posted October 20, 2003 by Rex in Bourne shell scripting

From a Bourne shell script (sh, ksh, bash, …), it is possible to test if a file exists and is writable by the user running the script.

if [ -w testfile ]
echo testfile is writable!
echo non writable...

The Conversation

Follow the reactions below and share your own thoughts.