【发布时间】:2012-08-24 13:21:14
【问题描述】:
我有一个如下的 bash 脚本:
#!/bin/bash
for i in `cat domains` ; do
tag=$(echo -n $i" - "; whois $i | grep -o "Expir.*")
reg=$(echo -n -" "; whois $i | grep "Registrar:")
echo $tag $reg
sleep .5s
done;
我希望有一个 php 页面,用户可以在其中粘贴域列表,当他们点击发送时,它会调用 bash 脚本处理域并返回输出。这可能吗?
【问题讨论】:
-
迭代文本文件的首选方法是
while read -r i; do ...; done < domains。见Bash FAQ 001。