test2.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. function TRInsertFolder()
  2. {
  3. ILINE=$1
  4. showtimestr=`date "+%m/%d/%Y, %H:%M:%S %p"`
  5. dttime=`date "+%Y-%m-%dT%H:%M:%SZ" -d "-8 hours"`
  6. echo $ILINE
  7. # newline="\t\t\t\t\t<tr class=\"file\">\n"
  8. newline="\t\t\t\t\t<tr class=\"file\">"
  9. sed -i "$ILINE a\ $newline" index.html
  10. ILINE=$(($ILINE+1))
  11. newline="\t\t\t\t\t\t<td></td>"
  12. sed -i "$ILINE a\ $newline" index.html
  13. ILINE=$(($ILINE+1))
  14. newline="\t\t\t\t\t\t<td>"
  15. sed -i "$ILINE a\ $newline" index.html
  16. ILINE=$(($ILINE+1))
  17. newline="\t\t\t\t\t\t\t<a href=\"$2/\">"
  18. sed -i "$ILINE a\ $newline" index.html
  19. ILINE=$(($ILINE+1))
  20. newline="\t\t\t\t\t\t\t\t<svg width=\"1.5em\" height=\"1em\" version=\"1.1\" viewBox=\"0 0 317 259\"><use xlink:href=\"#folder\"></use></svg>"
  21. sed -i "$ILINE a\ $newline" index.html
  22. ILINE=$(($ILINE+1))
  23. newline="\t\t\t\t\t\t\t\t<span class=\"name\">$2</span>"
  24. sed -i "$ILINE a\ $newline" index.html
  25. ILINE=$(($ILINE+1))
  26. newline="\t\t\t\t\t\t\t</a>"
  27. sed -i "$ILINE a\ $newline" index.html
  28. ILINE=$(($ILINE+1))
  29. newline="\t\t\t\t\t\t</td>"
  30. sed -i "$ILINE a\ $newline" index.html
  31. ILINE=$(($ILINE+1))
  32. newline="\t\t\t\t\t\t<td data-order=\"-1\">&mdash;</td>"
  33. sed -i "$ILINE a\ $newline" index.html
  34. ILINE=$(($ILINE+1))
  35. newline="\t\t\t\t\t\t<td class=\"hideable\"><time datetime=\"$dttime\">$showtimestr</time></td>"
  36. sed -i "$ILINE a\ $newline" index.html
  37. ILINE=$(($ILINE+1))
  38. newline="\t\t\t\t\t\t<td class=\"hideable\"></td>"
  39. sed -i "$ILINE a\ $newline" index.html
  40. ILINE=$(($ILINE+1))
  41. newline="\t\t\t\t\t</tr>"
  42. sed -i "$ILINE a\ $newline" index.html
  43. ILINE=$(($ILINE+1))
  44. }
  45. function TRInsert()
  46. {
  47. ILINE=$1
  48. echo $ILINE
  49. # newline="\t\t\t\t\t<tr class=\"file\">\n"
  50. newline="\t\t\t\t\t<tr class=\"file\">"
  51. sed -i "$ILINE a\ $newline" index.html
  52. ILINE=$(($ILINE+1))
  53. newline="\t\t\t\t\t\t<td></td>"
  54. sed -i "$ILINE a\ $newline" index.html
  55. ILINE=$(($ILINE+1))
  56. newline="\t\t\t\t\t\t<td>"
  57. sed -i "$ILINE a\ $newline" index.html
  58. ILINE=$(($ILINE+1))
  59. newline="\t\t\t\t\t\t\t<a href=\"$2\">"
  60. sed -i "$ILINE a\ $newline" index.html
  61. ILINE=$(($ILINE+1))
  62. newline="\t\t\t\t\t\t\t\t<svg width=\"1.5em\" height=\"1em\" version=\"1.1\" viewBox=\"0 0 317 259\"><use xlink:href=\"#file\"></use></svg>"
  63. sed -i "$ILINE a\ $newline" index.html
  64. ILINE=$(($ILINE+1))
  65. newline="\t\t\t\t\t\t\t\t<span class=\"name\">$2</span>"
  66. sed -i "$ILINE a\ $newline" index.html
  67. ILINE=$(($ILINE+1))
  68. newline="\t\t\t\t\t\t\t</a>"
  69. sed -i "$ILINE a\ $newline" index.html
  70. ILINE=$(($ILINE+1))
  71. newline="\t\t\t\t\t\t</td>"
  72. sed -i "$ILINE a\ $newline" index.html
  73. ILINE=$(($ILINE+1))
  74. newline="\t\t\t\t\t\t<td data-order=\"-1\">&mdash;</td>"
  75. sed -i "$ILINE a\ $newline" index.html
  76. ILINE=$(($ILINE+1))
  77. newline="\t\t\t\t\t\t<td class=\"hideable\"><time datetime=\"2022-02-27T12:42:28Z\">02/27/2022 12:42:28 PM +00:00</time></td>"
  78. sed -i "$ILINE a\ $newline" index.html
  79. ILINE=$(($ILINE+1))
  80. newline="\t\t\t\t\t\t<td class=\"hideable\"></td>"
  81. sed -i "$ILINE a\ $newline" index.html
  82. ILINE=$(($ILINE+1))
  83. newline="\t\t\t\t\t</tr>"
  84. sed -i "$ILINE a\ $newline" index.html
  85. ILINE=$(($ILINE+1))
  86. }
  87. function CreateFolder()
  88. {
  89. folderdir=$1
  90. mkdir $folderdir
  91. cd $folderdir
  92. cp ../../template/index.html ./
  93. cd ..
  94. }
  95. folder=/mnt/nfs1
  96. echo $folder
  97. cd $folder
  98. cd AGXXavier
  99. index1path=$folder
  100. if [ -f "index.html" ]; then
  101. index1path=$folder"/AGXXavier/index.html"
  102. else
  103. echo " no index.html in AGXXavier."
  104. exit -1
  105. fi
  106. echo $index1path
  107. tbodyline=`sed -n '/<tbody>/=' index.html`
  108. trline=$(($tbodyline+11))
  109. echo $trline
  110. filename="index.html"
  111. month=`date +%Y.%m`
  112. if [ ! -d "$month" ]; then
  113. CreateFolder $month
  114. TRInsertFolder $trline $month
  115. fi
  116. #TRInsert $trline "file.zip"
  117. #sed -i "$trline a\ hello word" index.html