Bash 输出数据到文件

Bash output data to file

我已经编译了 C 文件,命名为 a.out 我 运行 和 time ./a.out

这给了我这个输出:

Values in data mining increases by 30 in 100 seconds

real    5m3.898s
user    4m3.889s
sys     3m0.008s

我已经制作了一个脚本来自动执行此操作:

#!/bin/bash

time /home/full.sh >> /home/data.txt

但在我的 data.txt 文件中,我只看到这个(而不是时间数据):

Values in data mining increases by 30 in 100 seconds

要获得时间和脚本输出,您可以使用这个

 { time script; } &> outputfile

注意 & 符号