shell脚本一键安装php扩展模块

前端之家收集整理的这篇文章主要介绍了shell脚本一键安装php扩展模块前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

#!/bin/bash
#Program:
#	Accomplish to expand the specified function only one key
#History:
#	2013/11/15 pankai<[email protected]>	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

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

猜你在找的Shell相关文章