全部博文(512)
分类: LINUX
2005-11-15 17:47:55
1、快速把.c替换成.o
ll
*.c|awk '{print $9}'|sed -n
's/.c/.o/g p'
或者
ll
*.c |awk '{ gsub(/.c/, ".o"); print $9}'
2、杀死进程
if [ $# -ne 1 ] ; then
echo usage:
echo Program Param
exit
fi
processid=`ps -ef|grep -w $1 |grep -v grep|awk '{printf("%s
", $2)}'`
for id in $processid;
do
kill -9 $id
echo processID $id is killed
done
3、执行程序
if [ $# -ne 1 ] ; then
echo usage:
echo Program Param
exit 1
fi
$1 &
echo "$1 start succeed!"