Skip to content

Instantly share code, notes, and snippets.

@oliverdaff
Created May 20, 2013 01:57
Show Gist options
  • Save oliverdaff/5609983 to your computer and use it in GitHub Desktop.
Save oliverdaff/5609983 to your computer and use it in GitHub Desktop.
#!/bin/bash
ME=`whoami`
PROCESS=$1
echo $PROCESS
echo $ME
IPCS_S=`ipcs -s $PROCESS | egrep "0x[0-9a-f]+0-9]+" | grep $ME | cut -f2 -d" "`
IPCS_M=`ipcs -m $PROCESS | egrep "0x[0-9a-f]+[0-9]+" | grep $ME | cut -f2 -d" "`
IPCS_Q=`ipcs -q $PROCESS | egrep "0x[0-9a-f]+[0-9]+" | grep $ME | cut -f2 -d" "`
echo $IPCS_S
echo $IPCS_M
echo $IPCS_Q
#ipcs -m $PROCESS | egrep "0x[0-9a-f]+[0-9]+"
for id in $IPCS_M; do
ipcrm -m $id;
done
for id in $IPCS_S; do
ipcrm -s $id;
done
for id in $IPCS_Q; do
ipcrm -q $id;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment