Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 连接两个路径存储在变量中的文件_Bash_Shell_Scripting - Fatal编程技术网

Bash 连接两个路径存储在变量中的文件

Bash 连接两个路径存储在变量中的文件,bash,shell,scripting,Bash,Shell,Scripting,Bash中有两个变量,其中包含日志文件: #!/bin/bash a=/var/script/content1.log b=/var/script/content2.log /usr/bin/mail -s "Test" -- mail_address < $a $b #/bin/bash a=/var/script/content1.log b=/var/script/content2.log /usr/bin/mail-s“测试”--邮件地址

Bash中有两个变量,其中包含日志文件:

#!/bin/bash

a=/var/script/content1.log
b=/var/script/content2.log

/usr/bin/mail -s "Test" -- mail_address < $a $b
#/bin/bash
a=/var/script/content1.log
b=/var/script/content2.log
/usr/bin/mail-s“测试”--邮件地址<$a$b
直到现在,我还没有找到一种方法可以在同一封电子邮件中同时获取这两个日志

任何提示都将不胜感激

一旦您开始实际连接文件:


(不要忘记引用变量。)

因为您使用的是bash,所以可以使用流程替换:

/usr/bin/mail -s "Test" -- mail_address <(cat "$a" "$b")

/usr/bin/mail-s“Test”--邮件地址工作正常!谢谢:-)
/usr/bin/mail -s "Test" -- mail_address <(cat "$a" "$b")