更新时间:2023-01-23 09:19:24
在你的PHP文件名为test.php的,例如:
In your php file named test.php, for example
<?php
//like programs in c language, use $argc, $argv access command line argument number and arguments, uncomment below two line to dump $argc and $argv
//var_dump($argc); //an integer
//var_dump($argv); //an array with arguments
//use args and do anything you want
echo "do my job\n";
exit(0);
然后创建一个shell脚本命名test.sh
then create a shell script named test.sh
#! `which bash`
php=`which php`
i=10
while [[ $i -ge 0 ]];
do
$php test.php 1 2
((i--))
done
把两个文件在同一目录下。然后在终端中运行命令
bash test.sh