Thanks, after more testing it seems to continue doing what I want, but I am going to at least try to combine the two separate variable assignations (with all the sed) into one.
I trimmed this way down, I hope enough to be understandable. It is the main portion of this script file. It only takes input from what I think is a "bash built in" dialogs, I use kdialog. This works from a command line also, I do that sometimes for testing.
If I paste this at a bash prompt and make some choices ;
Code:
response=`kdialog --geometry 300x400+520+20 --separate-output --checklist "
Choose \"X out\" to just close this window.
You may re-open a Noise Complaint through the Auto_log
menu > \"Re-open_Noise_Complaint\"." "01Loud Voices" "Loud Voices" off "01Loud Music" "Loud Music" off "01Sounds like furniture scraping on the floor above" "Sounds like furniture scraping on the floor above" off "02Spoke to guest for the second time - made them aware of the possibility of being asked to leave the property if we keep getting complaints" "Spoke to offender in person - 2nd time" off "02Could not find disturbance" "Could not find disturbance" off "02@" "Type an entry" off`
response=`echo "$response" | sed -e ';$bw;:a;N;$!ba;:w;s/\n/*/g' -e s"%01%$timenow NATURE OF COMPLAINT;\\n%" -e s"%*%\\n%g" -e s"%01%%g"`
response=`echo "$response" | sed -e ';$bw;:a;N;$!ba;:w;s/\n/*/g' -e s"%02%\\n$timenow ACTION TAKEN;\\n%" -e s"%*%\\n%g" -e s"%02%%g"`
echo "$response"
I get something like this, which is what I want;
Code:
NATURE OF COMPLAINT;
Loud Voices
Loud Music
ACTION TAKEN;
Spoke to guest for the second time - made them aware of the possibility of being asked to leave the property if we keep getting complaints
Could not find disturbance
I direct the output to two different files, one is a running shift log and the other is an specific incident report. They are both plain text files.
Prior to making the change in the code it would not work if I only made one choice. Now it does. In my script file I do not have the final echoed variable (out to a files) in quotes but I did that so it would come out the same at a command line.