Korn shell (file check and creation function)

From Free media library

{{#switch: |Category = Pages in this category have | This page has }} been marked for eventual deletion.

{{#switch: |Category= They have

| It has}} been identified as reference material per the exclusion guidelines, which the community has decided to exclude from Wikisource (see "Inclusion of reference data on Wikisource"). These works will be phased out gradually; if you have found this page by following a link from another page, please go back and remove that link.

{{#switch::Korn shell (file check and creation function)

|Category:Deletion requests/Reference data =
|Wikisource:Scriptorium =  
|

}}


<Wikisource:Source code

You could easily add a second parameter in the following code to substitute the chmod 777 for a different, probably less generous, set of file permissions, or hard-code the change.

#!/usr/bin/ksh
#Author: Steve Callaway


function check_file
{

if [[ -e $1 ]]

then

echo $1 found

else

touch $1

chmod 777 $1

fi

return

}
Personal tools