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.
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?