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中打印日期的所有svn修订版_Bash_Sh - Fatal编程技术网

在Bash中打印日期的所有svn修订版

在Bash中打印日期的所有svn修订版,bash,sh,Bash,Sh,我需要在一个简单的周期内打印当天的所有SVN修订版,但我无法解析它们 我需要的是每天循环复习。我的问题是在脚本中获取修订日期和修订号,例如: log=$(svn log -r {2011-11-01}:Head) startDate= #??? get first commit date from log startCommit= #?? get first revision number from log for $rev in $(log); do # revisionDate=???

我需要在一个简单的周期内打印当天的所有SVN修订版,但我无法解析它们

我需要的是每天循环复习。我的问题是在脚本中获取修订日期和修订号,例如:

log=$(svn log -r {2011-11-01}:Head) 
startDate= #??? get first commit date from log
startCommit= #?? get first revision number from log

for $rev in $(log); do
#  revisionDate=??? (similar to startdate)   
#  revisionNumber=??? (similar to start commit)

   if [! $startDate = $revisionDate ]; then      
     echo $revisionDate
     echo $revisionNumber
   fi
done
这是svn日志的示例:

------------------------------------------------------------------------
r1619603 | aw | 2014-08-21 23:33:35 +0200 (Thu, 21 Aug 2014) | 2 lines

YARN-2436. [post-HADOOP-9902] yarn application help doesn't work

------------------------------------------------------------------------
r1619604 | jlowe | 2014-08-21 23:38:16 +0200 (Thu, 21 Aug 2014) | 2 lines

HADOOP-10893. isolated classloader on the client side. Contributed by Sangjin Lee

------------------------------------------------------------------------
r1619614 | jlowe | 2014-08-22 00:41:34 +0200 (Fri, 22 Aug 2014) | 2 lines

YARN-2434. RM should not recover containers from previously failed attempt when AM restart is not enabled. Contributed by Jian He

------------------------------------------------------------------------
r1619626 | sandy | 2014-08-22 01:28:44 +0200 (Fri, 22 Aug 2014) | 1 line

MAPREDUCE-5130. Add missing job config options to mapred-default.xml (Ray Chiang via Sandy Ryza)
------------------------------------------------------------------------
r1619632 | aw | 2014-08-22 01:58:25 +0200 (Fri, 22 Aug 2014) | 1 line

HADOOP-8896. Javadoc points to Wrong Reader and Writer classes in SequenceFile (Ray Chiang via aw)
------------------------------------------------------------------------

svn log
输出可以重定向到某个文件,并可用于进一步提取有用信息。PFB脚本提供所需日期的日志:-

#!/bin/bash

svn log > svn_logs_today.txt
printf "Enter the date in format YYYY-MM-DD for which revision no. to be displayed\n"
read var
#today=`date +%Y-%m-%d`
#if required today variable can be used for extracting todays report
cat svn_logs_today.txt| grep $var

您是否尝试过输出
$log
并查看它?是的,svn log的示例是$log变量的输出。不幸的是,这在我的情况下不起作用。。。将结果打印到一个文件中,然后top读取该文件(即使这会更加耗时)是可以的,但我需要在文件的每一行中写入数据和修订,回到我以前从svn日志中提取这些变量的问题-(这可能是我需要保存的文件(或更好的数组)的示例1619604 2014-08-21 1619614 2014-08-22 1619626 2014-08-23。。。