一起学习网 一起学习网


linux安装php扩展脚本分享

网络编程 linux安装php扩展脚本分享 06-21

测试环境:ubuntu 12.04 php 5.3.x


#!/bin/bash
#Program:
# Accomplish to expand the specified function only one key
#History:
# 2013/11/15 pankai<530911044@qq.com> first release
test ! -f ./ext_skel && echo "The shell script of 'ext_skel' doesn't exist in current directory.n" && exit 0
[ ! -d "skeleton" ] && echo "The directory of 'skeleton' doesn't exist in current directory.n" && exit 0
#include "./ext_skel"
read -p "Please input the extension name: " ext_name
#echo -e "hello $ext_name"

#The blank space is necessary
#Error:
# like: if[ ! -d "$ext_name" ]; then
if [ ! -d "$ext_name" ]; then
./ext_skel --extname=$ext_name
fi
file="./$ext_name/config.m4"
copy="./$ext_name/config"
if [ ! -f "./$ext_name/configs" ]; then
# Create a new file and clear it if it exists
:> "$copy"
cat "$file" | while read line
#for line in $( cat ./zend/config.m4 )
do
string=$( echo $line | grep 'PHP_ARG_ENABLE' )
if [ "$string" != "" ]; then
echo $line | cut -c5- >> $copy
read line
echo $line | cut -c5- >> $copy
read line
echo $line | cut -c5- >> $copy
read line
fi
echo $line >> $copy
done
mv "$file" "./$ext_name/configs"
mv "$copy" "./$ext_name/config.m4"
fi
cd $ext_name
phpize
./configure

通过shell进行数学运算的多种方式
在Bash中,bash的数学运算有点别扭,很难适应和记住,只好写个博文,方便以后翻翻看.有四种方式可以进行数学运算:一、let命令#/bin/bashnum1=13num2=14letsum=

监控服务器swap并重启php的Shell脚本
折中一下,写个脚本监控swap吧,放在crontab里面,2小时执行一次,世界安静了,再也没有烦人的报警短信了#!/bin/bashfunctionusage{echo"Usage:$0"echo"e.g.$01500"exit

nginx日志切割shell脚本
一、脚本思路第一步就是重命名日志文件,不用担心重命名后nginx找不到日志文件而丢失日志。在你未重新打开原名字的日志文件前,nginx还是会向你重


编辑:一起学习网

标签:脚本,日志,数学,文件,重命名