求助大神这个shell问题出现在哪里

sh/bash/dash/ksh/zsh等Shell脚本
回复
liufangj1n
帖子: 19
注册时间: 2012-10-17 20:25
系统: xubuntu 12.04

求助大神这个shell问题出现在哪里

#1

帖子 liufangj1n » 2013-06-28 16:30

1 #!/bin/bash
2
3 #随机读取一行
4 s=$(awk '{a[NR]=$0}END{srand();i=int(rand()*NR+1);print a}' /root/subject)
5
6 r=$(cat /root/receiver)
7
8#随机读取目录内容
9 c=$(find /root/content -type f | awk -vR=$RANDOM '{a[NR]=$0}END{print a[R%NR+1]}')

10 for (( i = 0; i < 5; i++))
11 do
12 mail -s $s ${r[$i]} < $c
13
14 done

运行后出现的提示:
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
mail: You must specify direct recipients with -s, -c, or -b
头像
麦斯特
帖子: 1034
注册时间: 2005-03-28 0:00
系统: Gentoo x64
来自: ☸我佛山人

Re: 求助大神这个shell问题出现在哪里

#2

帖子 麦斯特 » 2013-06-28 16:52

先弄清楚你那该死的mail命令的用法吧,或者直接在bash后面加个v,自然有更加详细的东西了。
Je ne suis pas d'accord avec ce que vous dites, mais je me battrai jusqu'à la mort pour que vous ayez le droit de le dire.
liufangj1n
帖子: 19
注册时间: 2012-10-17 20:25
系统: xubuntu 12.04

Re: 求助大神这个shell问题出现在哪里

#3

帖子 liufangj1n » 2013-06-28 17:14

root@xxx:~# bash v sendscipt
root@xxx:~#


加了v之后连提示都没有了
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30

Re: 求助大神这个shell问题出现在哪里

#4

帖子 aerofox » 2013-06-28 19:21

代码: 全选

bash -v sendscipt
回复