Shell script file handling

Hi

! /bin/sh

set logdir1 "logDir/local/logname"
#write the filename into a file
echo $logdir1 >> logname.txt

how do i exec the above echo command

You're probably trying to do something like this:

#!/bin/sh
logdir1="logDir/local/logname"

# are you trying to append?
# otherwise you can use '>' instead of '>>'
ls $logdir >> logname.txt