Advertisement
IordanRujinov

Linux Practical Task 1 edit1

Jan 19th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. file="./current.tag.txt"
  4. date=$(date +%y.%m.%d)
  5.  
  6.  
  7.  
  8.     curr_tag=$(cat < current.tag.txt)
  9.     curr_date=${curr_tag:0:8}
  10.     tag=${curr_tag:9}
  11.  
  12.     if [ $curr_date == $date ]; then
  13.         tag=$(($tag+1))
  14.     else
  15.         tag=1
  16.     fi
  17.  
  18. format_tag=`printf "%03d" $tag`
  19. echo $date.$tag > current.tag.txt
  20. echo $date.$format_tag
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement