This script is supposed to check the zm.conf file to make sure that the fields are populated (as this is primarily for a new install most should not) and ask for the values to populate those fields in the file. It asks and gets the value but Something is incorrect about my syntax to put to variable into the file.
So my problem is the line that starts with cat $ZM_CONFIG
if [ -f $ZM_CONFIG ]; then . $ZM_CONFIG else echo "ERROR: $ZM_CONFIG not found." exit 1 fi
for n in ZM_DB_SERVER ZM_DB_NAME ZM_DB_USER ZM_DB_PASS; do eval "val=\$$n" if [ "$val" = "" ]; then echo "ERROR($ZM_CONFIG): $n should not be empty." echo "Enter a $n for ZM to use the Database." echo -n "$n : " if [ "$n" = "ZM_DB_PASS" ]; then stty -echo # Turns off screen echo. read newval stty echo # Restores screen echo. else read newval fi cat $ZM_CONFIG |sed 's/^$n=.*$/$n=$newval/g' /tmp/$$ && mv /tmp/$$ $ZM_CONFIG fi done
This is the only show stopper for the new CTU-ZM 64 bit distro.
any help or ideas are welcome.
cat and sed have always been a week point for me and it is time I get a grasp on them. I have been googling for the last few days and am missing something in the syntax of how it all comes together. You'd think after I have managed to grasp everything else I'd get these. but looking as how the various wild card strings( Regular Expressions)can be put together, I'm lost. If even a pointer to some good tutorials would be helpful.
It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
I haven't ventured over to perl yet I have glanced over some documentation, but thats it. What was really buging me was that I was stuck on a one liner
It would be nice to be able to consentrate on learning just one language for a bit.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum