#filename sendscipt
#!/bin/bash
#随机读取一行
s=$(awk '{a[NR]=$0}END{srand();i=int(rand()*NR+1);print a}' /root/subject)
r=$(cat /root/receiver)
#随机读取目录内容
c=$(find /root/content -type f | awk -vR=$RANDOM '{a[NR]=$0}END{print a[R%NR+1]}')
for (( i = 0; i < 5; i++))
do
mail -s $s ${r[$i]} < $c
done
求助大神这个shell问题出现在哪里啊?
运行后出现下面的错误:
root@xxx:~# bash sendscipt
mail: You must specify direct recipients with -s, -c, or -b
mail: You must specify direct recipients with -s, -c, or -b
mail: You must specify direct recipients with -s, -c, or -b
lijikai047 于 2014-01-23 18:09:32发表:
顶
alick 于 2013-06-29 22:27:39发表:
[code] s=$(awk '{a[NR]=$0}END{srand();i=int(rand()*NR+1);print a}' /root/subject)[/code]这里是不是[code]print a[i][/code]不然 i 岂不是没有使用过?
riceleaf 于 2013-06-28 17:40:52发表:
帮你顶。