Hi Unix Gurus,
I have an issue with the output of the find command. I am doing a find on a directory /mntpt/dir2, where some user directories have spaces in the names. So while I am expecting the values of $myfile to be
"/mntpt/dir2/myfolder1/myfile1",
"/mntpt/dir2/my folder1/myfile2",
"/mntpt/dir2/my folder1/myfile3",
I am getting
/mntpt/dir2/myfolder1/myfile1,
/mntpt/dir2/my,
folder1/myfile2,
/mntpt/dir2/my,
folder1/myfile3,
Any suggestions ??
I am giving the loop that I am trying to manipulate below. Maybe an example of executing a user defined function in ksh and calling it from Ksh will be sufficient.
Thanks in advance
for myfile in `find "/mntpt/dir2" -type f -name '*'` ; do
mynewfile=`echo $myfile | sed -e "s/^\/mntpt\/newmntpt//" | sed -e "s/$/\.ext/"`
# Verify existance of the file
if [[ ! -f "$mynewfile" ]]; then
/usr/bin/echo "$mynewfile does not exist for $mynewfile"
fi
done
I have an issue with the output of the find command. I am doing a find on a directory /mntpt/dir2, where some user directories have spaces in the names. So while I am expecting the values of $myfile to be
"/mntpt/dir2/myfolder1/myfile1",
"/mntpt/dir2/my folder1/myfile2",
"/mntpt/dir2/my folder1/myfile3",
I am getting
/mntpt/dir2/myfolder1/myfile1,
/mntpt/dir2/my,
folder1/myfile2,
/mntpt/dir2/my,
folder1/myfile3,
Any suggestions ??
I am giving the loop that I am trying to manipulate below. Maybe an example of executing a user defined function in ksh and calling it from Ksh will be sufficient.
Thanks in advance
for myfile in `find "/mntpt/dir2" -type f -name '*'` ; do
mynewfile=`echo $myfile | sed -e "s/^\/mntpt\/newmntpt//" | sed -e "s/$/\.ext/"`
# Verify existance of the file
if [[ ! -f "$mynewfile" ]]; then
/usr/bin/echo "$mynewfile does not exist for $mynewfile"
fi
done