Hi there
please have a look at the code..i want to create Using a named pipe. Run a find in the background starting in the working directory
While this is happening wait for input from the user to ask him which file to find.
If the user does not enter any data in 10 seconds ask the user again.
Then see if the requested file name is found from the output of the find.
If more than one file is found number them 1 to n.
#!/bin/ksh
echo "Enter your process: "
read answer
FIND=`ps -elf | grep $answer | grep -v grep`
if [ $? -eq 0 ]; then
echo "process found"
FINDPROC=`echo "${FIND}"`
echo "$FINDPROC" | grep -i $answer > MeFile
count=`cat MeFile | wc -l`
printf "%s\n" "$count"
while [[ $count -gt 1 ]]; do
number=1
printf "%s\n" "$FINDPROC" | grep -i $answer
cat -n MeFile > result
printf "%s\n" | grep result
exit 0
done
else
echo "process not found"
read answer
fi