Skip to content

Instantly share code, notes, and snippets.

@nguyenhiepvan
Created September 23, 2021 03:06
Show Gist options
  • Save nguyenhiepvan/a583d92ea4b0e61605408b714564534e to your computer and use it in GitHub Desktop.
Save nguyenhiepvan/a583d92ea4b0e61605408b714564534e to your computer and use it in GitHub Desktop.
simple library
#!/bin/sh
echo "Ho va ten:"
read name
echo "Lop:?"
read class
echo "So dien thoai:"
read phone_number
echo "Thu vien sach"
echo "------------------------------------------"
echo "ID TEN SACH TAC GIA"
echo "------------------------------------------"
input="sach.txt"
while IFS= read -r line
do
echo "$line"
done < "$input"
echo -e "So phieu $RANDOM Ngay muon: $(date '+%d/%m/%Y')" >> phieumuon.txt
echo -e " PHIEU MUON SACH " >> phieumuon.txt
echo -e "Ban doc: $name Lop: $class So dien thoai: $phone_numer" >> phieumuon.txt
echo -e "------------------------------------------" >> phieumuon.txt
echo -e "Chi tiet sach muon:" >> phieumuon.txt
echo -e "STT ID TEN SACH TAC GIA SO LUONG" >> phieumuon.txt
index = 1
sum = 0
do
echo "Sach can muon:"
read code;
echo "So luong:"
read quantity;
OUTPUT=$(cat sach.txt | grep code)
echo -e"$index ${OUTPUT} $quantity" >> phieumuon.txt
((index=index+1))
((sum=sum+quantity))
done
echo -e "------------------------------------------" >> phieumuon.txt
echo -e " Tong Cong: $sum" >> phieumuon.txt
echo -e "NV thu thu Ban doc" >> phieumuon.txt
echo -e "(ky ten) (ky ten)" >> phieumuon.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment