Guest User

Untitled

a guest
Sep 14th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. # This shell script is to tabulate and search for SR
  3. n=0 # Initial value for Sl.No
  4. next_n=$[$n+1]
  5. read -p "Enter your SR number : " SR
  6. echo -e "$next_nt$SRt$(date)" >> /tmp/cases.txt
  7.  
  8. 1 123 <date>
  9.  
  10. 1 123 <date>
  11. 2 456 <date>
  12.  
  13. #!/bin/bash
  14. # This shell script is to tabulate and search for SR
  15. next_n=$(($(tail -n1 /tmp/cases.txt 2>/dev/null | cut -f1) + 1))
  16. read -p "Enter your SR number : " SR
  17. echo -e "$next_nt$SRt$(date)" >> /tmp/cases.txt
  18.  
  19. [ -s "/tmp/cases.txt" ] || : > /tmp/cases.txt
  20. next_n=$(expr "$(wc -l < /tmp/cases.txt)" + 1)
  21. read -p "Enter your SR number: " SR
  22. printf '%dt%dt%sn' "$next_N" "$SR" "$(date)" >> /tmp/cases.txt
Add Comment
Please, Sign In to add comment