Test environment: Ubuntu 12.04 PHP 5.3.x
Copy Code code as follows:
#!/bin/bash
#Program:
# accomplish to expand the specified function is only one key
#History:
# 2013/11/15 Pankai<530911044@qq.com>
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)
Todo
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