Shell???????????
???????????? ???????[ 2015/6/10 11:26:47 ] ?????????????? Linux
????????????????????????ο?????
????[root@localhost ~]
????# ./note.sh
????Phone number?
????556
????Name?
????Janine
????Issue?
????Mouse was broken.
????[root@localhost ~]
????# cat data.txt
????987/Jimmy/Keybord issue.
????556/Janine/Mouse was broken.
????[root@localhost ~]
????#
??????????????????????????????????????????????????ū??Щ??????????????á????????????????????date????????????????????????????????
????[root@localhost ~]
????# date
????Thu Apr 23 21:33:14 EEST 2015 <---- date???????????
????[root@localhost ~]
????# date "+%Y.%m.%d %H:%M:%S"
????2015.04.23 21:33:18 <---- ???????????
?????м????????????????????????????????????????£?????????`??????????????????????????~????????λ????
????[root@localhost ~]
????# cat note.sh
????#!/bin/bash
????now=`date "+%Y.%m.%d %H:%M:%S"`
????echo "Phone number?"
????read phone
????echo "Name?"
????read name
????echo "Issue?"
????read issue
????echo "$now/$phone/$name/$issue">>data.txt
????[root@localhost ~]
????# ./note.sh
????Phone number?
????123
????Name?
????Jim
????Issue?
????Script hanging.
????[root@localhost ~]
????# cat data.txt
????2015.04.23 21:38:56/123/Jim/Script hanging.
????[root@localhost ~]
????#
??????…… ??????????????е????????????????????????????????read?????????read?????????????Щ?????????ù??????????????-p???????????
????[root@localhost ~]
????# cat note.sh
????#!/bin/bash
????now=`date "+%Y.%m.%d %H:%M:%S"`
????read -p "Phone number: " phone
????read -p "Name: " name
????read -p "Issue: " issue
????echo "$now/$phone/$name/$issue">>data.txt
???????????????????????????????????????????????????man read?? man echo?? man date?? man ……
??????????????????????????
????[root@localhost ~]
????# ./note.sh
????Phone number: 321
????Name: Susane
????Issue: Mouse was stolen
????[root@localhost ~]
????# cat data.txt
????2015.04.23 21:38:56/123/Jim/Script hanging.
????2015.04.23 21:43:50/321/Susane/Mouse was stolen
????[root@localhost ~]
????#
????????????????棨???????μ?????У??????е????????LCTT ?????????? echo ????????????????????? -n ???????????С???
???????
??????????????????????????????????????綽???????ζ??????У?????????鷳????????????Щ????????????????????
????[root@localhost ~]
????# cat note.sh
????#!/bin/bash
????while true
????do
????read -p "Phone number: " phone
????now=`date "+%Y.%m.%d %H:%M:%S"`
????read -p "Name: " name
????read -p "Issue: " issue
????echo "$now/$phone/$name/$issue">>data.txt
????done
???????????????read phone??now=date?е?λ?á???????????????????綽????????????????????????????????У?????????κ????? now ????????洢??????к??????????????????????????κ?п?????20??????????????
????[root@localhost ~]
????# ./note.sh
????Phone number: 123
????Name: Jim
????Issue: Script still not works.
????Phone number: 777
????Name: Daniel
????Issue: I broke my monitor
????Phone number: ^C
????[root@localhost ~]
????# cat data.txt
????2015.04.23 21:38:56/123/Jim/Script hanging.
????2015.04.23 21:43:50/321/Susane/Mouse was stolen
????2015.04.23 21:47:55/123/Jim/Script still not works.
????2015.04.23 21:48:16/777/Daniel/I broke my monitor
????[root@localhost ~]
????#
??????? ???????????????????????[Ctrl]+[C]????Shell?????^??? CTRL ????
??????ù???????
????????????????????????“??????????Frankenstein??”??????????????κ?к?????????????????????????????????????????????Ρ?????????????????cat???data.txt??
????[root@localhost ~]
????# cat data.txt
????2015.04.23 21:38:56/123/Jim/Script hanging.
????2015.04.23 21:43:50/321/Susane/Mouse was stolen
????2015.04.23 21:47:55/123/Jim/Script still not works.
????2015.04.23 21:48:16/777/Daniel/I broke my monitor
????2015.04.23 22:02:14/123/Jimmy/New script also not working!!!
????[root@localhost ~]
????#
??????????????????????????????cut??????cut????????г??????饗??????÷???“/”????????????????Σ?
????[root@localhost ~]
????# cat data.txt | cut -d"/" -f2
????123
????321
????123
????777
????123
????[root@localhost ~]
????#
????????????????????????????????????????sort??
????[root@localhost ~]
????# cat data.txt | cut -d"/" -f2|sort
????123
????123
????123
????321
????777
????[root@localhost ~]
????#
???????????μ??С????????????????-c????uniq????
????[root@localhost ~]
????# cat data.txt | cut -d"/" -f2 | sort | uniq -c
????3 123
????1 321
????1 777
????[root@localhost ~]
????#
??????????????????????????
????#!/bin/bash
????while true
????do
????read -p "Phone number: " phone
????now=`date "+%Y.%m.%d %H:%M:%S"`
????read -p "Name: " name
????read -p "Issue: " issue
????echo "$now/$phone/$name/$issue">>data.txt
????echo "===== We got calls from ====="
????cat data.txt | cut -d"/" -f2 | sort | uniq -c
????echo "--------------------------------"
????done
???????У?
????[root@localhost ~]
????# ./note.sh
????Phone number: 454
????Name: Malini
????Issue: Windows license expired.
????===== We got calls from =====
????3 123
????1 321
????1 454
????1 777
????--------------------------------
????Phone number: ^C
?????????????????????????裺
??????????
??????????????
?????洢??????
????????洢??????
????????????????е?????????????????????????????????????????????????洢???????в????Щ?????????????Щ???飬??????????switches/cases?????????????????????????????????shell??“??”???????????á?
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????