關於terminal 指令 - MAC

By Dora
at 2017-08-11T21:02
at 2017-08-11T21:02
Table of Contents
macOS是一個unix
所有unix裡面都是一切皆視為檔案
螢幕是檔案、鍵盤是檔案、word檔是檔案、你的shell檔是檔案
所有檔案都有分權限
權限又有三種分別是讀、寫、執行
又一個系統共有三類型使用者所以一個檔案共有9種權限
譬如說 如果某個shell檔缺少執行權限那./xxx.sh就不行 得使用sh ./xxx.sh用sh指令
來讀取shell的內容再執行
所以有些shell檔不能直接執行要加上sh指令是因為這個原因
所以根本沒有什麼執行檔這種東西 人人加上執行權限都可以執行 只是會發生什麼事就
不知道了
那為什麼要./呢
每個檔案都有自己的路徑
理論上在讀寫執行任何檔案的時候都得要告訴電腦那個檔案的路徑
只有少數重要的會事先告訴系統它們的路徑 這樣事後使用者在使用時就不用再打路徑了
至於./
.代表的是現在所在的檔案夾的意思
/代表該資料夾下面的檔案
假設你現在在/Users/user/Desktop下面並且想要執行裡面一個叫做test.out的檔案
可以打./test.out或~/Desktop/test.out
或/Users/user/Desktop/test.out
這些東西在所有unix系列OS都可以適用
--
所有unix裡面都是一切皆視為檔案
螢幕是檔案、鍵盤是檔案、word檔是檔案、你的shell檔是檔案
所有檔案都有分權限
權限又有三種分別是讀、寫、執行
又一個系統共有三類型使用者所以一個檔案共有9種權限
譬如說 如果某個shell檔缺少執行權限那./xxx.sh就不行 得使用sh ./xxx.sh用sh指令
來讀取shell的內容再執行
所以有些shell檔不能直接執行要加上sh指令是因為這個原因
所以根本沒有什麼執行檔這種東西 人人加上執行權限都可以執行 只是會發生什麼事就
不知道了
那為什麼要./呢
每個檔案都有自己的路徑
理論上在讀寫執行任何檔案的時候都得要告訴電腦那個檔案的路徑
只有少數重要的會事先告訴系統它們的路徑 這樣事後使用者在使用時就不用再打路徑了
至於./
.代表的是現在所在的檔案夾的意思
/代表該資料夾下面的檔案
假設你現在在/Users/user/Desktop下面並且想要執行裡面一個叫做test.out的檔案
可以打./test.out或~/Desktop/test.out
或/Users/user/Desktop/test.out
這些東西在所有unix系列OS都可以適用
--
Tags:
MAC
All Comments

By Brianna
at 2017-08-15T06:44
at 2017-08-15T06:44

By Kristin
at 2017-08-17T04:28
at 2017-08-17T04:28

By Ursula
at 2017-08-18T02:01
at 2017-08-18T02:01

By Zenobia
at 2017-08-21T07:48
at 2017-08-21T07:48

By Sarah
at 2017-08-23T17:32
at 2017-08-23T17:32

By Damian
at 2017-08-28T14:07
at 2017-08-28T14:07

By Andy
at 2017-09-02T05:01
at 2017-09-02T05:01

By Tracy
at 2017-09-02T07:15
at 2017-09-02T07:15

By Robert
at 2017-09-02T20:09
at 2017-09-02T20:09

By Connor
at 2017-09-07T04:01
at 2017-09-07T04:01

By Queena
at 2017-09-08T12:54
at 2017-09-08T12:54

By Emily
at 2017-09-08T20:25
at 2017-09-08T20:25

By Kelly
at 2017-09-13T16:09
at 2017-09-13T16:09

By Ida
at 2017-09-17T09:01
at 2017-09-17T09:01

By Barb Cronin
at 2017-09-19T11:06
at 2017-09-19T11:06

By Carol
at 2017-09-23T01:50
at 2017-09-23T01:50

By Freda
at 2017-09-26T23:47
at 2017-09-26T23:47

By Yedda
at 2017-09-28T21:14
at 2017-09-28T21:14

By Steve
at 2017-10-01T09:28
at 2017-10-01T09:28

By Susan
at 2017-10-04T05:34
at 2017-10-04T05:34

By Callum
at 2017-10-05T01:44
at 2017-10-05T01:44

By Kristin
at 2017-10-08T00:43
at 2017-10-08T00:43

By Ivy
at 2017-10-11T21:14
at 2017-10-11T21:14

By Lily
at 2017-10-14T01:46
at 2017-10-14T01:46

By Genevieve
at 2017-10-17T07:09
at 2017-10-17T07:09

By Olivia
at 2017-10-18T18:45
at 2017-10-18T18:45

By Dora
at 2017-10-20T18:10
at 2017-10-20T18:10

By Queena
at 2017-10-22T07:02
at 2017-10-22T07:02

By Ivy
at 2017-10-23T09:37
at 2017-10-23T09:37

By Oscar
at 2017-10-28T03:53
at 2017-10-28T03:53

By Jake
at 2017-10-29T07:22
at 2017-10-29T07:22

By Elvira
at 2017-10-31T05:02
at 2017-10-31T05:02

By Andrew
at 2017-11-01T20:48
at 2017-11-01T20:48
Related Posts
在safari中 對網頁畫記號? (請益)

By Linda
at 2017-08-11T20:24
at 2017-08-11T20:24
關於terminal 指令

By Quintina
at 2017-08-11T18:11
at 2017-08-11T18:11
2個與4個thunderbolt3的選擇

By Kelly
at 2017-08-11T14:43
at 2017-08-11T14:43
usb-c接hdmi電視有高頻雜音

By Oscar
at 2017-08-11T11:37
at 2017-08-11T11:37
usb-c hub 問題請教

By Daph Bay
at 2017-08-11T09:51
at 2017-08-11T09:51