Hi All,
I have a problem with Null values while reading line by line from a text file. I wrote a shell script to read set of file names from a text file line by line, and zipping the each individual file and copying those zip files into some separate directory, and removing the original file from current directory. My shell script is as follows
#!/usr/bin/ksh
cat OCloader_gdlfiles/loaded_gdl_archive_file_list.txt | while read LINE
do
zip OCloader_archive/gdl_loaded/$LINE.zip OCloader_gdlfiles/$LINE
rm OCloader_gdlfiles/$LINE
done
Note:- Here OCloader_gdlfiles is a soft link to some other directory in unix box.
Now my problem was, Suppose while reading the lines from the text file, if any null input is assigned to the LINE variable then the rm command is as follows
rm OCloader_gdlfiles/NULL
then the corresponding soft link is removing from the unix box. To avoid this how should i change my code. I don't have any idea to do this. Your help will be appriciated.