User:Starko/I Hate Linux

From SWGANH Wiki
Jump to: navigation, search
  1. !/bin/sh
  1. 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

  1. 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

  1. 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 "
";

basename $file

echo "
"; echo "
";

sortFiles $file

echo "
";

else

echo "
";

basename $file

echo "
";

fi done }

  1. Start of script
  2. Entering file parameters

if [ $# -ne 3 ] then error "Please enter 3 arguments"; fi

  1. Run fileCheck function to make sure that directories and files are correct

fileCheck

  1. Display header on page and import classes

cat $2

  1. Run sortFiles, remove directory imformation

sortFiles $1

  1. Show footer

cat $3 exit;

the most pointless script i have ever had to write... >_<