Click to See Complete Forum and Search --> : ksh compare file/directory names script


SeT
08-27-2004, 02:51 PM
I'm pretty new to shell scripting and need to write a script that will add a dash to sets of numbers and take the new numbers(directory names) and compare them with currently existing directories creating a new document. If the directories are there, I need the number and size, otherwise I need the number and it to say closed. So far:



#!/bin/ksh

sed -e 's/\(...\)\(....\)/\1-\2/' directories.txt

if [ ! -d unk ] ; then
print closed
else
du unk > dir.txt
fi




Where I put "unk" means I'm not sure what I should do there. I have been searching and reading and haven't found a simple way to take what the sed command gives me and test that. There's gotta be a better way to do this but I can't think of it atm.