是否有一个命令行参数,允许您在没有用户提示的情况下安装PHP Pear?我想自动执行以下执行:
wget http://pear.PHP.net/go-pear.phar
PHP go-pear.phar
pear config-set preferred_state beta
pear channel-discover pear.PHPunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps PHPunit/PHPUnit
rm go-pear.phar
PHP go-pear.phar提示用户输入安装/配置信息.
解决方法:
原来expect做了伎俩.这是我最终得到的:
install-pear.sh
#!/usr/bin/expect
spawn wget -O /tmp/go-pear.phar http://pear.PHP.net/go-pear.phar
expect eof
spawn PHP /tmp/go-pear.phar
expect "1-11, 'all' or Enter to continue:"
send "\r"
expect eof
spawn rm /tmp/go-pear.phar
install-PHPunit.sh
#!/bin/bash
./install-pear.sh
pear config-set preferred_state beta
pear channel-discover pear.PHPunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps PHPunit/PHPUnit
跑步:
sudo apt-get install expect
chmod 744 ./install-pear.sh
chmod 744 ./install-PHPunit.sh
sudo ./install-PHPunit.sh