#!/bin/sh

ipcrm='To delete ipcrm shm'

#program name
if [ `whoami` != "root" ] ; then 
	echo "Permission denied!"
    exit
fi

ipcsm=`ipcs -m`
echo "$ipcsm"
 
ipcsm=`ipcs -m|grep '0x'|awk '{print $2}'`
for FILE in $ipcsm; do
	ipcrm shm $FILE
done					

ipcsm=`ipcs -s`
echo "$ipcsm"
 
ipcsm=`ipcs -s|grep '0x'|awk '{print $2}'`
for FILE in $ipcsm; do
	ipcrm sem $FILE
done					

ipcsm=`ipcs -q`
echo "$ipcsm"
 
ipcsm=`ipcs -q|grep '0x'|awk '{print $2}'`
for FILE in $ipcsm; do
	ipcrm msg $FILE
done					
