Communication between processes in Unix

hi folks!!
I was stuck with a little problem where i needed to communcate between two processes, i.e., send a command to the parent process from the child process as soon as the child process terminates.This was required when i wanted to create a log using the script command in a bourne shell.The following is the script that i am running:

#!/bin/sh
set -x
echo `date`|sed "s/[:' ']//g" >name
 head -1  name | read name1
script ./logs/$name1.txt
if [ $0=exit ];
then
exit
logout #*#
fi

~
#*# At this point in the code, when the user wants to exit, i need to ask the parent process to logout (send the logout command in the process) so that the user finally gets out of the server.

Can anyone help me in this?

A child process cannot affect its parent.

The parent must use the output or exit status of the child.

Why echo?

Why sed?

Why not use a format string with date?

Why use head? (And the name1 variable will not be available anywhere else in the script unless you are using ksh)

read name1 < name

But why are you using a temporary file?

That will always be true (or a syntax error if $0 contains spaces).

Why would you expect $0 to contain exit? $0 contains the path to the current script.

hi.. I am sorry for confusing you on this.Trust me, i am just a beginner in shell scripting. I was merely trying to create a file containing all the commands and the outputs that the user tries on the shell and save it with the filename of the output of the date command modified with the sed command. Thats why i used sed command to create the filename and $name1 will contain the output of the date command after filtered.
But finally made a mistake in the $0 line of the command as u rightly pointed out.

But, is there a way that we can send a number as an exit status to the parent process and the latter then determines the next action to be carried out.If yes, whats the command?

Thanks in advance.

There is no need to use sed. You can use a format string as an argument to date:

filename=$(date +%Y-%m-%d.txt)

Normally, the exit status of a command is contained in the special parameter, $?, but script always seems to exit without an error.