Liunx操作day-05

一、上堂回顧

安裝git

sudo apt-get install git

創(chuàng)建版本庫(kù)【本地版本庫(kù)】

普通目錄滴某,git init

創(chuàng)建文件在工作區(qū)狈孔,git add filename git commit -m "日志描述"

時(shí)光穿梭機(jī)

版本回退:git reset --hard HEAD^ 或者git reset --hard commit id

工作區(qū)/版本庫(kù)/暫存區(qū)

管理修改:git status / git diff HEAD -- filename :查看版本庫(kù)和工作區(qū)之間的不同

撤銷修改:

a.修改了工作區(qū)中的文件珠插,但是還沒(méi)有add

git checkout -- filename :丟棄工作區(qū)的修改

b.修改了工作區(qū)中的文件,add到暫存區(qū)跋核,但是還沒(méi)有commit

git reset HEAD filename:丟棄暫存區(qū)的修改

git checkout -- filename

c.修改了工作區(qū)中的文件,并add岖瑰,commit

回退版本

刪除文件:

刪除工作區(qū)中的文件:rm filename

刪除版本庫(kù)中的文件:git rm filename

遠(yuǎn)程倉(cāng)庫(kù)

添加ssh key【建立當(dāng)前計(jì)算機(jī)和遠(yuǎn)程倉(cāng)庫(kù)之間的連接】

添加遠(yuǎn)程倉(cāng)庫(kù):先有本地倉(cāng)庫(kù),然后根據(jù)本地倉(cāng)庫(kù)創(chuàng)建遠(yuǎn)程倉(cāng)庫(kù)

git remote add origin git@github.com:username/learngit.git:建立班底和遠(yuǎn)程倉(cāng)庫(kù)之間的連接

git push -u origin master:將當(dāng)前的master分支推送到遠(yuǎn)程倉(cāng)庫(kù)

git push origin master:以后再修改之后砂代,可以再次推送

克隆倉(cāng)庫(kù):先有遠(yuǎn)程倉(cāng)庫(kù)蹋订,然后將遠(yuǎn)程倉(cāng)庫(kù)克隆到本地

git clone git@github.com:username/clonegit.git

分支管理

創(chuàng)建并切換分支:git checkout -b dev

切換分支:git checkout dev

查看分支:git branch

合并到master:切換到master分支,執(zhí)行命令git merge dev

二刻伊、git

6.分支管理

6.4bug分支

一般情況下露戒,每個(gè)bug都需要使用一個(gè)分支來(lái)進(jìn)行解決椒功,解決后,分支刪除

git stash:可以把當(dāng)前工作現(xiàn)場(chǎng)儲(chǔ)存起來(lái)智什,然后先進(jìn)行其他額的工作动漾,完成工作之后,可以解封繼續(xù)工作

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n42" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">演示命令:
rock@rockrong:~/Desktopcd day5Text/ rock@rockrong:~/Desktop/day5Text git branch

  • master
    rock@rockrong:~/Desktop/day5Textvim README.md #假如有工作未完成 rock@rockrong:~/Desktop/day5Text git stash #封存工作現(xiàn)場(chǎng)
    保存工作目錄和索引狀態(tài) WIP on dev: e742319 Initial commit

創(chuàng)建bug分支

rock@rockrong:~/Desktop/day5Textgit checkout -b bug-01 切換到一個(gè)新分支 'bug-01' rock@rockrong:~/Desktop/day5Text vim README.md
rock@rockrong:~/Desktop/day5Textgit add README.md rock@rockrong:~/Desktop/day5Text git commit -m "fixed a bug"
[bug-01 235be14] fixed a bug
1 file changed, 2 insertions(+), 1 deletion(-)
rock@rockrong:~/Desktop/day5Textgit checkout master 切換到分支 'master' #bug修復(fù) 合并 rock@rockrong:~/Desktop/day5Text git merge --no-ff -m "merge bug-01" bug-01
Merge made by the 'recursive' strategy.
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

刪除bug分支

rock@rockrong:~/Desktop/day5Text$ git branch -d bug-01
已刪除分支 bug-01(曾為 235be14)荠锭。

查看封存列表

rock@rockrong:~/Desktop/day5Text$ git stash list
stash@{0}: WIP on dev: e742319 Initial commit

解開(kāi)封存.這時(shí)會(huì)沖突,解決沖突

rock@rockrong:~/Desktop/day5Text$ git stash pop</pre>

總結(jié):

修復(fù)bug時(shí)旱眯,創(chuàng)建一個(gè)新的分支,進(jìn)行bug的修復(fù)证九,然后合并删豺,最后刪除

當(dāng)手頭的工作沒(méi)有完成的時(shí)候,使用git stash 將內(nèi)容封存愧怜,然后取修復(fù)bug呀页,當(dāng)bug修復(fù)完成之后,則使用命令git stash pop解封

6.5feature分支

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n48" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 0px; width: inherit;">演示命令:
rock@rockrong:~/Desktop/day5Text$ git branch
dev

  • master
    rock@rockrong:~/Desktop/day5Textgit checkout -b feature1 切換到一個(gè)新分支 'feature1' rock@rockrong:~/Desktop/day5Text touch a.txt
    rock@rockrong:~/Desktop/day5Textgit add a.txt rock@rockrong:~/Desktop/day5Text git commit -m "create a.txt"
    [feature1 120a22f] create a.txt
    1 file changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 a.txt
    rock@rockrong:~/Desktop/day5Textgit status 位于分支 feature1 無(wú)文件要提交拥坛,干凈的工作區(qū) rock@rockrong:~/Desktop/day5Text vim a.txt
    rock@rockrong:~/Desktop/day5Textgit add a.txt rock@rockrong:~/Desktop/day5Text git status
    位于分支 feature1
    要提交的變更:
    (使用 "git reset HEAD <文件>..." 以取消暫存)
    ?
    修改: a.txt
    ?
    rock@rockrong:~/Desktop/day5Textgit commit -m "add hello" [feature1 af31c25] add hello 1 file changed, 1 insertion(+) rock@rockrong:~/Desktop/day5Text git checkout dev
    切換到分支 'dev'
    rock@rockrong:~/Desktop/day5Textgit branch -d feature1 #正常刪除 error: 分支 'feature1' 沒(méi)有完全合并蓬蝶。 如果您確認(rèn)要?jiǎng)h除它,執(zhí)行 'git branch -D feature1'猜惋。 rock@rockrong:~/Desktop/day5Text git branch -D feature1 #強(qiáng)制刪除
    已刪除分支 feature1(曾為 af31c25)丸氛。</pre>

總結(jié):

每開(kāi)發(fā)一個(gè)新的功能【版本迭代】,最好新建一個(gè)分支來(lái)進(jìn)行操作

如果需要丟棄一個(gè)還沒(méi)有被合并的分支惨奕,使用命令 git branch -D branch-name

6.6多人協(xié)作

當(dāng)你從遠(yuǎn)程倉(cāng)克隆時(shí)雪位,實(shí)際上git將本地的master和遠(yuǎn)程的master對(duì)應(yīng)起來(lái)了竭钝,并且遠(yuǎn)程倉(cāng)庫(kù)的默認(rèn)的名字為origin

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n55" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">演示命令:
rock@rockrong:~/Desktop/day5Textgit remote #查看遠(yuǎn)程庫(kù)的信息 origin rock@rockrong:~/Desktop/day5Text git remote -v
origin git@github.com:yangyang-git/day5Text.git (fetch) #抓取地址
origin git@github.com:yangyang-git/day5Text.git (push) #推送地址</pre>

1>推送分支

推送分支:把該分支上的所有的本地提交推送到遠(yuǎn)程庫(kù)梨撞,推送時(shí),要指定本地分支

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n59" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">演示命令:
rock@rockrong:~/Desktop/day5Text$ git branch

  • dev
    master

推送到主分支

rock@rockrong:~/Desktop/day5Text$ git push origin master
對(duì)象計(jì)數(shù)中: 4, 完成.
Delta compression using up to 2 threads.
壓縮對(duì)象中: 100% (2/2), 完成.
寫入對(duì)象中: 100% (4/4), 340 bytes | 340.00 KiB/s, 完成.
Total 4 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To github.com:yangyang-git/day5Text.git
e742319..cc4bef3 master -> master

創(chuàng)建子分支

rock@rockrong:~/Desktop/day5Text$ git checkout -b dev

推送到子分支

rock@rockrong:~/Desktop/day5Text$ git push origin dev
Total 0 (delta 0), reused 0 (delta 0)
To github.com:yangyang-git/day5Text.git

  • [new branch] dev -> dev</pre>

總結(jié):

并不是所有的分支都需要推送到遠(yuǎn)程倉(cāng)庫(kù)

a.master分支時(shí)主分支香罐,因此要時(shí)刻與遠(yuǎn)程保持同步

b.dev是一個(gè)開(kāi)發(fā)分支卧波,團(tuán)隊(duì)所有的成員都在上面工作,所以也需要推送到遠(yuǎn)程倉(cāng)庫(kù)

c.bug分支只是修復(fù)一個(gè)bug庇茫,就沒(méi)必要推送到遠(yuǎn)程

d.先本地刪除分支,再刪除遠(yuǎn)程分支git push origin --delete dev

2>抓取分支

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n68" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 0px; width: inherit;">演示命令:

老王和老李,在做同一個(gè)項(xiàng)目

rock@rockrong:~/Desktop/day5Textcd .. rock@rockrong:~/Desktop mkdir other
rock@rockrong:~/Desktopcd other/ rock@rockrong:~/Desktop/other git clone git@github.com:yangyang-git/day5Text.git
正克隆到 'day5Text'...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 10 (delta 2), reused 6 (delta 1), pack-reused 0
接收對(duì)象中: 100% (10/10), 完成.
處理 delta 中: 100% (2/2), 完成.
rock@rockrong:~/Desktop/other$ cd day5Text/

老王抓取下來(lái)只有master

rock@rockrong:~/Desktop/other/day5Text$ git branch

  • master

但是老王需要在dev上工作,所以創(chuàng)建dev分支

rock@rockrong:~/Desktop/other/day5Textgit checkout -b dev origin/dev 分支 'dev' 設(shè)置為跟蹤來(lái)自 'origin' 的遠(yuǎn)程分支 'dev'港粱。 切換到一個(gè)新分支 'dev' rock@rockrong:~/Desktop/other/day5Text git branch

  • dev
    master
    rock@rockrong:~/Desktop/other/day5Texttouch b.txt rock@rockrong:~/Desktop/other/day5Text vim b.txt
    rock@rockrong:~/Desktop/other/day5Textgit add b.txt rock@rockrong:~/Desktop/other/day5Text git commit -m "b"
    [dev b08d6ec] b
    1 file changed, 1 insertion(+)
    create mode 100644 b.txt

老王推送到遠(yuǎn)程倉(cāng)庫(kù)

rock@rockrong:~/Desktop/other/day5Text$ git push origin dev #推送分支
對(duì)象計(jì)數(shù)中: 3, 完成.
Delta compression using up to 2 threads.
壓縮對(duì)象中: 100% (2/2), 完成.
寫入對(duì)象中: 100% (3/3), 274 bytes | 274.00 KiB/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:yangyang-git/day5Text.git
ae20ec5..b08d6ec dev -> dev
?

過(guò)一陣子,老李也推送遠(yuǎn)程倉(cāng)庫(kù).這個(gè)時(shí)候推送失敗,因?yàn)闆_突了.

$ git push origin dev
To github.com:michaelliao/learngit.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'git@github.com:michaelliao/learngit.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解決辦法是,把遠(yuǎn)程最新代碼拿來(lái)下,在本地合并,在push

抓取失敗,根據(jù)提示操作旦签,原因是沒(méi)有指定本地dev分支與遠(yuǎn)程origin/dev分支的鏈接

rock@rockrong:~/Desktop/day5Text$ git pull
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
展開(kāi)對(duì)象中: 100% (3/3), 完成.
來(lái)自 github.com:yangyang-git/day5Text
ae20ec5..b08d6ec dev -> origin/dev
當(dāng)前分支沒(méi)有跟蹤信息查坪。
請(qǐng)指定您要合并哪一個(gè)分支。
詳見(jiàn) git-pull(1)宁炫。
?
git pull <遠(yuǎn)程> <分支>
?
如果您想要為此分支創(chuàng)建跟蹤信息偿曙,您可以執(zhí)行:
?
git branch --set-upstream-to=origin/<分支> dev

設(shè)置本地和遠(yuǎn)程都有dev,就可以pull了

rock@rockrong:~/Desktop/day5Textgit branch --set-upstream-to=origin/dev dev 分支 'dev' 設(shè)置為跟蹤來(lái)自 'origin' 的遠(yuǎn)程分支 'dev'。 #設(shè)置跟蹤 rock@rockrong:~/Desktop/day5Text git pull #抓取分支
更新 ae20ec5..b08d6ec
Fast-forward
b.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 b.txt

此時(shí)羔巢,兩個(gè)小伙伴之間就可以各自工作了望忆,然后只需要將各自的修改每次提交到dev分支

rock@rockrong:~/Desktop/day5Textvim b.txt rock@rockrong:~/Desktop/day5Text git add b.txt
rock@rockrong:~/Desktop/day5Textgit commit -m "hello" [dev 61c1d88] hello 1 file changed, 1 insertion(+) rock@rockrong:~/Desktop/day5Text git push origin dev
對(duì)象計(jì)數(shù)中: 3, 完成.
Delta compression using up to 2 threads.
壓縮對(duì)象中: 100% (2/2), 完成.
寫入對(duì)象中: 100% (3/3), 284 bytes | 284.00 KiB/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:yangyang-git/day5Text.git
b08d6ec..61c1d88 dev -> dev
rock@rockrong:~/Desktop/day5Textcd .. rock@rockrong:~/Desktop cd other/day5Text/
rock@rockrong:~/Desktop/other/day5Textgit pull remote: Counting objects: 3, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0 展開(kāi)對(duì)象中: 100% (3/3), 完成. 來(lái)自 github.com:yangyang-git/day5Text b08d6ec..61c1d88 dev -> origin/dev 更新 b08d6ec..61c1d88 Fast-forward b.txt | 1 + 1 file changed, 1 insertion(+) rock@rockrong:~/Desktop/other/day5Text cat b.txt
fghajdfja
hello
?

注意:如果合并有沖突罩阵,需要手動(dòng)解決,解決的方法和分支管理中的解決沖突完全一樣启摄。解決后稿壁,提交,再push

實(shí)際的工作流程是:先pull[抓取]歉备,后push[推送]</pre>

總結(jié):

a.查看遠(yuǎn)程庫(kù)的信息傅是,使用git remote -v

b.本地新建的分支如果不推送到遠(yuǎn)程,對(duì)其他人都是不可見(jiàn)的

c.從本地推送分支蕾羊,使用命令git push origin branchname,如果推送失敗落午,則先用git pull抓取

d.在本地創(chuàng)建于遠(yuǎn)程分支的連接,使用命令git checkout -b branchname origin/branchname

e肚豺。從遠(yuǎn)程抓取分支溃斋,使用git pull,如果有沖突吸申,則要先解決沖突

7.標(biāo)簽管理

7.1創(chuàng)建標(biāo)簽

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n78" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 0px; width: inherit;">演示命令:
rock@rockrong:~/Desktop/day5Textgit tag v1.0 #創(chuàng)建標(biāo)簽梗劫,默認(rèn)創(chuàng)建的是當(dāng)前最新提交的標(biāo)簽 rock@rockrong:~/Desktop/day5Text git tag
v1.0
rock@rockrong:~/Desktop/day5Textgit tag v0.2 ae20ec5 #為指定commit id創(chuàng)建標(biāo)簽 rock@rockrong:~/Desktop/day5Text git tag
v0.2
v1.0</pre>

總結(jié):

  • 命令git tag <tagname>用于新建一個(gè)標(biāo)簽,默認(rèn)為HEAD截碴,也可以指定一個(gè)commit id梳侨;
  • 命令git tag -a <tagname> -m "blablabla..."可以指定標(biāo)簽信息;
  • 命令git tag可以查看所有標(biāo)簽日丹。
7.2操作標(biāo)簽

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n89" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 0px; width: inherit;">演示命令:
rock@rockrong:~/Desktop/day5Text$ git show v1.0 #查看指定標(biāo)簽的詳細(xì)信息
commit 61c1d8863fd7df3d20c156ace3bfa1d7882b636c (HEAD -> dev, tag: v1.0, origin/dev)
Author: yangyang-git 18501970795@163.com
Date: Mon Jul 2 10:52:50 2018 +0800
?
hello
?
diff --git a/b.txt b/b.txt
index 9022bb8..4bc9d07 100644
--- a/b.txt
+++ b/b.txt
@@ -1 +1,2 @@
fghajdfja
+hello

創(chuàng)建標(biāo)簽走哺,攜帶標(biāo)簽的描述信息

rock@rockrong:~/Desktop/day5Text$ git tag -a v0.1 -m "version 0.1" e7423195

rock@rockrong:~/Desktop/day5Textgit tag #查看當(dāng)前分支下的標(biāo)簽 v0.1 v0.2 v1.0 rock@rockrong:~/Desktop/day5Text git tag -d v0.1
已刪除標(biāo)簽 'v0.1'(曾為 97026a8)
rock@rockrong:~/Desktop/day5Text$ git push origin --tags #將本地倉(cāng)庫(kù)中的標(biāo)簽推送到遠(yuǎn)程倉(cāng)庫(kù)
Total 0 (delta 0), reused 0 (delta 0)
To github.com:yangyang-git/day5Text.git

  • [new tag] v0.2 -> v0.2
  • [new tag] v1.0 -> v1.0
    rock@rockrong:~/Desktop/day5Textgit tag -d v0.2 #刪除本地倉(cāng)庫(kù)中的標(biāo)簽 已刪除標(biāo)簽 'v0.2'(曾為 ae20ec5) rock@rockrong:~/Desktop/day5Text git push origin :refs/tags/v0.2

刪除遠(yuǎn)程倉(cāng)庫(kù)中的指定標(biāo)簽

remote: warning: Deleting a non-existent ref.
To github.com:yangyang-git/day5Text.git

  • [deleted] v0.2To</pre>

總結(jié):

  • 命令git push origin <tagname>可以推送一個(gè)本地標(biāo)簽;
  • 命令git push origin --tags可以推送全部未推送過(guò)的本地標(biāo)簽哲虾;
  • 命令git tag -d <tagname>可以刪除一個(gè)本地標(biāo)簽丙躏;
  • 命令git push origin :refs/tags/<tagname>可以刪除一個(gè)遠(yuǎn)程標(biāo)簽。

三束凑、shell編程

1.簡(jiǎn)介

1.1什么是shell

把在終端運(yùn)行的命令保存到文件中晒旅,這個(gè)文件就是shell程序

簡(jiǎn)單的說(shuō),shell編程就是第Linux命令的邏輯化處理

1.2shell解析器的類型

bash汪诉,ash废恋,ksh等,默認(rèn)使用bash

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" contenteditable="true" cid="n109" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">演示命令:
echo $SHELL
/bin/bash</pre>

1.3shell的作用

如果需要反復(fù)執(zhí)行某些Linux命令扒寄,則可以將這些命令寫到一個(gè)shell腳本中鱼鼓,然后每次只需要運(yùn)行一下這個(gè)腳本即可

2.第一個(gè)shell程序

2.1實(shí)現(xiàn)

打開(kāi)文本編輯器(可以使用 tou'ch命令來(lái)創(chuàng)建文件),新建一個(gè)文件 test.sh该编,擴(kuò)展名為 sh(sh代表shell)迄本,擴(kuò)展名并不影響腳本執(zhí)行,見(jiàn)名知意就好

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n118" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">#!/bin/bash

打印hello world

echo "Hello World !"</pre>

2.2運(yùn)行

方式一:作為可執(zhí)行程序

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n122" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">touch test.sh
vim test.sh
chmod +x ./test.sh
./test.sh</pre>

方式二:作為解釋器參數(shù)

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="Python" contenteditable="true" cid="n124" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">/bin/bash test.sh </pre>

3.shell中的變量

3.1變量的定義

定義:變量名=值

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n129" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">演示命令:
your_name="zhangsan" #定義變量沒(méi)有,賦值符中間不允許有空格 echoyour_name #使用是必須有num=10 echo{num}
?

注意:變量名外面的花括號(hào)是可選的上渴,加不加都行岸梨,加花括號(hào)是為了幫助解釋器識(shí)別變量的邊界

echo "his name is ${your_name}"</pre>

3.2只讀變量

readonly:只讀喜颁,將變量聲明為readonly,只讀變量的值不能發(fā)生改變

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n133" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">myUrl="http://www.baidu.com"
readonly myUrl
myUrl="http://www.1000phone.com"
?

運(yùn)行腳本,報(bào)錯(cuò):/bin/sh: NAME: This variable is read only</pre>

3.3刪除變量

unset:刪除變量

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n137" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">代碼演示:
myUrl="http://www.baidu.com"
unset myUrl
echo $myUrl
?

變量被刪除后不能再次使用曹阔。unset 命令不能刪除只讀變量半开。

以上實(shí)例執(zhí)行將沒(méi)有任何輸出</pre>

4.字符串和數(shù)組

4.1字符串

雙引號(hào)或者單引號(hào)

單引號(hào)的限制:

a.單引號(hào)中的任何字符都會(huì)原樣輸出,單引號(hào)字符串中的變量是無(wú)效的

b.單引號(hào)字符串中不能再出現(xiàn)單引號(hào)【對(duì)單引號(hào)進(jìn)行轉(zhuǎn)義后去不起作用】

總結(jié):

雙引號(hào):可以包含除了$赃份、`寂拆、\、‘‘之外的任意字符

單引號(hào):其中的任意字符都不會(huì)被解析抓韩,都會(huì)原樣輸出

反引號(hào):會(huì)將其中的內(nèi)容作為命令執(zhí)行

反斜線:轉(zhuǎn)義特定的字符纠永,如:&、*谒拴、^尝江、等

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n151" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">代碼演示:

!/bin/bash

?

定義字符串

your_name='qinjx'
str="Hello, I know you are "$your_name"! \n"
?

拼接字符串

your_name="qinjx"
greeting="hello, "your_name" !" greeting_1="hello,{your_name} !"
echo greetinggreeting_1
?

獲取字符串長(zhǎng)度

string="abcd"
echo ${#string} #輸出 4
?

提取子字符串

string="1000phone is a great site"
echo ${string:1:4} #包頭包尾
?

查找子字符串

string="1000phone is a great company"
echo expr index "$string" is #查找is在string中的位置,從1開(kāi)始計(jì)數(shù)
?

注意: 以上腳本中 "`" 是反引號(hào),而不是單引號(hào) "'"英上,不要看錯(cuò)了哦</pre>

4.2數(shù)組

bash只支持一維數(shù)組炭序,不支持多維數(shù)組

并沒(méi)有限制數(shù)組的大小

數(shù)組元素的下標(biāo)也是從0開(kāi)始的,獲取數(shù)組中的元素使用下標(biāo)

定義數(shù)組:數(shù)組名=(值1 值2 值3....)

注意:shell中的數(shù)組元素之間使用空格分隔

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n160" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">#數(shù)組的定義
arr1=(10 20 30 40)
echo arr1 #打印出第0個(gè)元素 arr2=( 10 20 30 40 ) echoarr2
?

數(shù)組的使用

讀取數(shù)組中的元素

echo ${arr1[2]}

如果要讀取數(shù)組中的全部元素

echo ${arr2[@]}
?

取得數(shù)組元素的個(gè)數(shù)

length={#arr1[@]} echolength

或者

length={#arr1[*]} echolength

取得數(shù)組單個(gè)元素的長(zhǎng)度

lengthn={#arr1[3]} echolengthn</pre>

5.shell中的運(yùn)算符

expr:是一款表達(dá)式計(jì)算工具苍日,使用它能夠完成表達(dá)式的求值操作

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n165" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">val=expr 1 + 2
echo "兩數(shù)之和為 : $val"
?

1.算術(shù)運(yùn)算符 運(yùn)算符兩側(cè)一定要空格

val=expr $a + $b
echo "a + b : val" ? val=`expra * b` echo "a * b :val"
?

2.關(guān)系運(yùn)算符

[]中惭聂,前后都需要空格

if [ a -eqb ]
then
echo "a -eqb : a 等于 b"
else
echo "a -eqb: a 不等于 b"
fi
?

3.邏輯運(yùn)算符

if [ 1 -lt 3 -a 2 -lt 3 ] 和下面的語(yǔ)句一個(gè)意思

if [ 1 -lt 3 ] && [ 2 -lt 3 ]
then
echo "ok"
fi</pre>

6.echo、printf相恃、test命令

1>echo

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n169" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">echo -e "OK! \n" # -e 開(kāi)啟轉(zhuǎn)義,\n 顯示換行
echo -e "OK! \c" # -e 開(kāi)啟轉(zhuǎn)義 \c 不換行
?
echo date #顯示命令執(zhí)行結(jié)果

注意: 這里使用的是反引號(hào) `, 而不是單引號(hào) '辜纲。

結(jié)果為:Thu Jul 24 10:08:46 CST 2014</pre>

2>printf

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n171" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">printf "%-10s %-8s %-4s\n" 姓名 性別 體重kg
printf "%-10s %-8s %-4.2f\n" 張三 男 66.1234
printf "%-10s %-8s %-4.2f\n" 李四 男 48.6543 </pre>

注意:

%s %d %f都是格式替換符

-10s:指的是一個(gè)寬度為10的字符(-表示左對(duì)齊,沒(méi)有則表示右對(duì)齊)拦耐,任何字符都會(huì)填充在這10個(gè)字符內(nèi)耕腾,如果不足則使用空格自動(dòng)填充

-4.2f:指的是格式化為小數(shù),其中.2表示保留小數(shù)點(diǎn)后兩位

3>test

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n177" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;">#1.數(shù)值測(cè)試
num1=100
num2=100
if test [num1] -eq[num2]
then
echo '兩個(gè)數(shù)相等揩魂!'
else
echo '兩個(gè)數(shù)不相等幽邓!'
fi
?

2.字符串測(cè)試

num1="hello"
num2="hello11"
if test num1 =num2 #比較字符不能使用==,==只能比較數(shù)字
then
echo '兩個(gè)字符串相等!'
else
echo '兩個(gè)字符串不相等!'
fi
?

3.文件測(cè)試

cd /bin
if test -e ./bash
then
echo '文件已存在!'
else
echo '文件不存在!'
fi</pre>

test命令用來(lái)監(jiān)測(cè)某個(gè)條件是否成立,他可以進(jìn)行數(shù)值火脉,字符和文件的監(jiān)測(cè)

7.shell中的流程控制語(yǔ)句

7.1分支語(yǔ)句

if,case

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n184" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">#if語(yǔ)句

單分支

if [ 1 -lt 3 ] && [ 2 -lt 3 ]
then
echo "ok"
fi
?

雙分支

num1=[2*3] num2=[1+5]

if else語(yǔ)句經(jīng)常與test命令結(jié)合使用

if test [num1] -eq[num2]
then
echo '兩個(gè)數(shù)字相等!'
else
echo '兩個(gè)數(shù)字不相等!'
fi
?

多分支

a=10
b=20
if [ a ==b ]
then
echo "a 等于 b"
elif [ a -gtb ]
then
echo "a 大于 b"
elif [ a -ltb ]
then
echo "a 小于 b"
else
echo "沒(méi)有符合的條件"
fi
?
?

case語(yǔ)句

echo '輸入 1 到 4 之間的數(shù)字:'
echo '你輸入的數(shù)字為:'
read aNum
case $aNum in

  1. echo '你選擇了 1'
    ;;
  2. echo '你選擇了 2'
    ;;
  3. echo '你選擇了 3'
    ;;
  4. echo '你選擇了 4'
    ;;
    *) echo '你沒(méi)有輸入 1 到 4 之間的數(shù)字'
    ;;
    esac</pre>
7.2循環(huán)語(yǔ)句

for while until

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n189" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">#for語(yǔ)句

需求:順序輸出當(dāng)前列表中的數(shù)字

for num in 1 2 3 4 5
do
echo "The value is: $num"
done
?
?

需求:順序輸出字符串中的字符

for str in 'This is a string' "good" "well"
do
echo $str
done
?

需求:遍歷數(shù)組中的所有元素

a=(1 2 3)
for x in {a[*]} do echox
done

while語(yǔ)句

需求:輸出數(shù)字1到5

int=1
while(( int<=5 )) #(()) 像C語(yǔ)言一樣,去執(zhí)行代碼
do
echo $int
let "int++" #let 可以直接進(jìn)行加減 ++等操作
done
?
?

需求:求1~10之間所有整數(shù)的和

i=1
sum=0
while (( i<10 ))
do
let sum+=i
let i++
done
echo $sum
?
?

until語(yǔ)句

i=1
until (( i>10 ))
do
echo $i
((i++))
done
?</pre>

8.函數(shù)

代碼演示:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" contenteditable="true" cid="n193" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 0px; margin-top: 15px; width: inherit;">#無(wú)參無(wú)返回值

定義函數(shù)

demo()
{
echo 'hello world'
}

調(diào)用函數(shù)

demo
?

有返回值

funWithReturn(){
echo "輸入第一個(gè)數(shù)字: "
read aNum
echo "輸入第二個(gè)數(shù)字: "
read anotherNum
return ((aNum+anotherNum)) } funWithReturn echo? #這個(gè)$?表示上面函數(shù)的返回值
?

有參有返回值

arg()
{
echo 1 #第一個(gè)參數(shù) echo2 #第二個(gè)參數(shù)
echo # #參數(shù)個(gè)數(shù) echo* #用字符串的形式,顯示所有參數(shù)
return 123 #只能返回?cái)?shù)字,并且取值是0~255
}
?
arg 1 2 #調(diào)用arg函數(shù),并且傳入1 2作為參數(shù)

$? 表示函數(shù)的返回值

echo $?</pre>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末柒啤,一起剝皮案震驚了整個(gè)濱河市倦挂,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌担巩,老刑警劉巖方援,帶你破解...
    沈念sama閱讀 219,039評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異涛癌,居然都是意外死亡犯戏,警方通過(guò)查閱死者的電腦和手機(jī)送火,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,426評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)先匪,“玉大人种吸,你說(shuō)我怎么就攤上這事⊙椒牵” “怎么了坚俗?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,417評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)岸裙。 經(jīng)常有香客問(wèn)我猖败,道長(zhǎng),這世上最難降的妖魔是什么降允? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,868評(píng)論 1 295
  • 正文 為了忘掉前任恩闻,我火速辦了婚禮,結(jié)果婚禮上剧董,老公的妹妹穿的比我還像新娘判呕。我一直安慰自己,他們只是感情好送滞,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,892評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布侠草。 她就那樣靜靜地躺著,像睡著了一般犁嗅。 火紅的嫁衣襯著肌膚如雪边涕。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 51,692評(píng)論 1 305
  • 那天褂微,我揣著相機(jī)與錄音功蜓,去河邊找鬼。 笑死宠蚂,一個(gè)胖子當(dāng)著我的面吹牛式撼,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播求厕,決...
    沈念sama閱讀 40,416評(píng)論 3 419
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼著隆,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了呀癣?” 一聲冷哼從身側(cè)響起美浦,我...
    開(kāi)封第一講書(shū)人閱讀 39,326評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎项栏,沒(méi)想到半個(gè)月后浦辨,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,782評(píng)論 1 316
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡沼沈,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,957評(píng)論 3 337
  • 正文 我和宋清朗相戀三年流酬,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了币厕。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,102評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡芽腾,死狀恐怖旦装,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情晦嵌,我是刑警寧澤同辣,帶...
    沈念sama閱讀 35,790評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站惭载,受9級(jí)特大地震影響旱函,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜描滔,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,442評(píng)論 3 331
  • 文/蒙蒙 一棒妨、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧含长,春花似錦券腔、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,996評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至陪腌,卻和暖如春辱魁,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背诗鸭。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,113評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工染簇, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人强岸。 一個(gè)月前我還...
    沈念sama閱讀 48,332評(píng)論 3 373
  • 正文 我出身青樓锻弓,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親蝌箍。 傳聞我的和親對(duì)象是個(gè)殘疾皇子青灼,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,044評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 一、上堂回顧 安裝git? sudo apt-get install git創(chuàng)建版本庫(kù)【本地版本庫(kù)】? 普通目錄十绑,...
    WenErone閱讀 393評(píng)論 0 0
  • 1. 安裝 Github 查看是否安裝git: $ git config --global user.name "...
    Albert_Sun閱讀 13,661評(píng)論 9 163
  • Git 命令行學(xué)習(xí)筆記 Git 基礎(chǔ) 基本原理 客戶端并不是只提取最新版本的文件快照聚至,而是把代碼倉(cāng)庫(kù)完整的鏡像下來(lái)...
    sunnyghx閱讀 3,921評(píng)論 0 11
  • 前言 Git使用教程 Git是什么 Git是一個(gè)開(kāi)源的分布式版本控制系統(tǒng),用于敏捷高效地處理任何或小或大的項(xiàng)目本橙。 ...
    90后的思維閱讀 907評(píng)論 0 0
  • 1.一個(gè)人,你只有溫暖純良了脆诉,你才可以有資格談?wù)搻?ài)與自由甚亭,否則贷币,自由,多少罪惡假汝之名亏狰。 2.人世上沒(méi)有事是有意義...
    閑情逸致1314閱讀 98評(píng)論 0 1