User:Starko/I Hate Linux
From SWGANH Wiki
- !/bin/sh
- Error message
error() { echo $1; exit }
function fileCheck() { if [ -d $1 ] then continue #to run script #Nothing needed as true by default else error "The directory does not exist"; #Error code for no directory fi if [ -f $2 ] then continue
- Nothing needed as true by default
else error "The 1st file does not exist";#Error code for no file fi if [ -f $3 ] then continue
- Nothing needed as true by default
else error "The 2nd file does not exist";#Error code for no file fi }
function sortFiles () { for file in $1/* do if [ -d $file ] then
echo "";"; echo "basename $file
echo "";";sortFiles $file
echo "else
echo "";";basename $file
echo "fi done }
- Start of script
- Entering file parameters
if [ $# -ne 3 ] then error "Please enter 3 arguments"; fi
- Run fileCheck function to make sure that directories and files are correct
fileCheck
- Display header on page and import classes
cat $2
- Run sortFiles, remove directory imformation
sortFiles $1
- Show footer
cat $3 exit;
the most pointless script i have ever had to write... >_<