Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This shell script is to tabulate and search for SR
- n=0 # Initial value for Sl.No
- next_n=$[$n+1]
- read -p "Enter your SR number : " SR
- echo -e "$next_nt$SRt$(date)" >> /tmp/cases.txt
- 1 123 <date>
- 1 123 <date>
- 2 456 <date>
- #!/bin/bash
- # This shell script is to tabulate and search for SR
- next_n=$(($(tail -n1 /tmp/cases.txt 2>/dev/null | cut -f1) + 1))
- read -p "Enter your SR number : " SR
- echo -e "$next_nt$SRt$(date)" >> /tmp/cases.txt
- [ -s "/tmp/cases.txt" ] || : > /tmp/cases.txt
- next_n=$(expr "$(wc -l < /tmp/cases.txt)" + 1)
- read -p "Enter your SR number: " SR
- printf '%dt%dt%sn' "$next_N" "$SR" "$(date)" >> /tmp/cases.txt
Add Comment
Please, Sign In to add comment