Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. getnum(){
  2. ls "$1" | grep "$2$"
  3. }
  4.  
  5. getnum() {
  6. ls "$1" | grep "$s$" | cut -d_ -f 2
  7. }
  8.  
  9. getnum() {
  10. ls "$1" | grep "$s$" | cut -d_ -f 2 | sort -n
  11. }
  12.  
  13. getnum() {
  14. ls "$1" | grep "$s$" | cut -d_ -f 2 | sort -n | head -1
  15. }
  16.  
  17. getnum() {
  18. local oldnum=$(ls "$1" | grep "$s$" | cut -d_ -f 2 | sort -n | head -1)
  19. }
  20.  
  21. getnum() {
  22. local oldnum=$(ls "$1" | grep "$s$" | cut -d_ -f 2 | sort -n | head -1)
  23. if [ "$oldnum" = "" ]
  24. then
  25. oldnum=0
  26. fi
  27. printf "%02dn" $(($oldnum+1))
  28. }
  29.  
  30. dir=somewhere/logs
  31. ext=testfile.json
  32. cp template $dir/$(date +%Y%m%d_)$(getnum "$dir" "$ext")_$USER_$ext
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement