在五樓寫程式
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
<font color="#8A2BE2">[W1-1]</font> Command Line Basic === 快速了解本篇目錄 [TOC] # 1. Intro ## 講古 * 參考 author note 100% 最新的 * 歷史 * Mac OS 用 Bash shell 當作終端機 * Catalina 用 Z shell 當作終端機 (需要一些其他) <br> * :::spoiler 終端機簡稱 * command line = shell = terminal = bash * :::spoiler 終端機功能 * 建立資料夾...等等 # 2. Main Page ## 指令 man man導覽頁 與 q跳出 ```= man man //導覽 q //回到 Command Line ``` man man ![](https://i.imgur.com/mDr12jN.png) ![](https://i.imgur.com/vNIguza.png) q ![](https://i.imgur.com/OOdgMxi.png) # 3. Navigation ## 新增 ```= pwd //你現在在哪 ls //有哪些資料夾 cd 檔案名 斜線 //去哪個檔案 ex: cd Download/ cd //上一頁 clear //刪除之前終端機訊息 man ls //檢索快捷鍵 -a //可以看隱藏資料夾,因為隱藏資料夾都會是 .文件名,configuration file (配置檔案) //.目前檔案 //..檔案裡面的檔案 ls cd Download //或是可以簡寫 cd Dow+tab鍵,會自動補齊文字 cd ``` ![](https://i.imgur.com/yaTaeVj.png) ![](https://i.imgur.com/vITzqS3.png) ![](https://i.imgur.com/YrMVcmA.png) # 4. Creation and Destruction ## 新增、開啟檔案、刪除 ```= mkdir 檔案名 //在目錄中建立檔案 mkdir 檔案名 //在目錄中建立檔案 touch 檔案名.檔案格式 //一般來說會用在開啟瀏覽器,但如果沒有該檔案,會在檔案中建立檔案 open . //用Finder彈出視窗,把檔案開啟給我看 cp 點選檔案名.點選檔案格式 複製新檔案名 新檔案格式 //複製檔案 rm 檔案名.檔案格式/ //刪除檔案,不能刪除資料夾 rmdir 資料夾名/ //刪除資料夾,資料夾內必須是空的,才刪的掉 rm -r 資料夾名/ //直接刪除資料夾以及資料夾內的檔案 步驟示範 mkdir 秘密資料夾 cd 秘密資料夾 touch 秘密檔案-1.txt open . cp 秘密檔案-1.txt 秘密檔案複製檔-2.txt rm 秘密檔案複製檔-2.txt cd .. 返回上一層 rm -r 秘密資料夾 ``` ![](https://i.imgur.com/bZtFloO.png) ![](https://i.imgur.com/7ALHPnk.png) ![](https://i.imgur.com/VJIv1B5.png) ![](https://i.imgur.com/KeaCBAb.png) # 5. Creation and Destruction: Hierarchy Challenge ## 實際練習,並且施作Symbolic Link ```= mkdir 檔案夾A 檔案夾B 檔案夾C //新增3個檔案夾 cd .. //往上一層目錄移動 方法1 cd 檔案夾/ && touch 檔案.檔案格式 && cd .. //進入檔案夾並且新增某個格式的檔案最後跳回上一頁 ls 檔案夾/ //查看某檔案夾裡面的項目 方法2 touch 檔案夾/檔案名.檔案格式 //在某檔案夾內新增某格式的檔案 ln -s /Users/Bob/Downloads/Users/Bob/Desktop ln -s 我要的檔案(拖曳) 要在哪一層層(拖曳) pwd ls mkdir birds mammals reptiles //一次建立三個資料夾 ls cd birds/ && touch eagles.txt && cd .. //進入鳥資料夾並且新增老鷹純文字檔最後返回上一層 ls birds/ //查看鳥資料夾下有什麼項目 touch reptiles/trex.txt //爬行類動物資料夾下新增trex純文字檔 ls touch mammals/koala.txt //哺乳類資料夾下新增無尾熊純文字檔 ln -s birds/eagle.txt strongestAnimals.txt //Symbolic Link ls -l //查看Symbolic Link ``` 一次建立多個資料夾 ![](https://i.imgur.com/Pe2hPKw.png) Link 用程式打 ![](https://i.imgur.com/nfquoVV.png) Link 用滑鼠拖曳 ![](https://i.imgur.com/ap7Cr41.png) ![](https://i.imgur.com/FPNjM6I.png) ![](https://i.imgur.com/NjfJ81G.png) ![](https://i.imgur.com/BmPpl8l.png) [參考Youtube](https://www.youtube.com/watch?v=43mGItOoJIM) ![](https://i.imgur.com/LOcZQzv.png) # 6. Find 眾多檔案中找到user.c檔案 ![](https://i.imgur.com/5II5xsK.png) ```= 拖曳檔案在終端機會直接生成檔案路徑 長按option鍵可以直接 切換移動打字位置 find . -name user.c //使用find方法找到該檔案,印出地址 cd 地址 //進入檔案 進入Vim vim user.c 先按下Esc案件,開通編輯 int user_count() { return 1; } :wq //離開 cd - //回到上次的資料夾,不是上一層,是該層最一開始 find . -name '*.hs' //查找.hs的檔案 find . -empty //查找空檔案或空目錄 ``` ![](https://i.imgur.com/Gl0aGZC.png) ![](https://i.imgur.com/GOUJCDz.png) [參考Vim鳥哥](https://linux.vbird.org/linux_basic/centos7/0310vi.php) # 7. Searching Inside Files 找出csv檔案中,名字是carlos喜愛的數字 ```= head workers.csv //在檔案夾下進入 grep "carlos" workers.csv //報錯誤,因為打小寫 方法1 找出carlos喜歡數字 用grep grep "carlos" workers.csv -i //找到檔案內名字是carlos的人,-i是告訴終端機不要管大小寫差異 方法2 找出carlos喜歡數字 用cat cat workers.csv | grep -Eo ',[0-9]+.[0-9],' ``` 印出csv檔案內 名字與薪水 ``` 印出csv檔案內 名字與薪水 名字在$3欄 薪水在$4欄 head worker.csv awk -F "," '{ print $3, $4}' workers.csv //$匿名參數 ``` ![](https://i.imgur.com/FpXr2Fi.png) :::success | GREP | GREP | | | -------- | -------- | -------- | | ![](https://i.imgur.com/Q3J8cLN.png)|![](https://i.imgur.com/SPI7QP7.png)| | ```= 先進入該檔案夾 cd /Users/yinbob/Desktop/2023/AppWorks/遠端/W1/Command\ Line/video-clb-materials-versions-1.0/07-searching-inside-files 進入檔案方式1 head workers.csv 進入檔案方式2 cat workers.csv | grep "Carlos" 印出favorite number cat workers.csv | grep -Eo ',[0-9]+.[0-9]+,' ``` 進入檔案 ![](https://i.imgur.com/yvFTEnx.png) 找出有叫Carlos的人 方式1 head workers.csv ![](https://i.imgur.com/6687WZW.png) 找出有叫Carlos的人 方式2 cat workers.csv | grep "Carlos" ![](https://i.imgur.com/FW2Lh0G.png) 印出favorite number cat workers.csv | grep -Eo ',[0-9]+.[0-9]+,' ![](https://i.imgur.com/hA8geE0.png) ::: <hr> :::info | AWK | | | | -------- | -------- | -------- | |![](https://i.imgur.com/VogWgvs.png)| ![](https://i.imgur.com/Eq6m8QK.png)| | ```= 總覽 head workers.csv 取出第三欄 第四欄的 名字 薪水 awk -F "," '{ print $3, $4 }' workers.csv //$符號是參數 第三欄column 第四欄column> ``` 總覽 head workers.csv ![](https://i.imgur.com/LxmuDlU.png) 取出第三欄 第四欄的 名字 薪水 awk -F "," '{ print $3, $4 }' workers.csv ![](https://i.imgur.com/ErFoaat.png) ::: 最終結果 ![](https://i.imgur.com/zsBp7F3.png) # 8. Challenge: Sorting ![](https://i.imgur.com/u9rZUng.png) 目標結果 ![](https://i.imgur.com/sWABdCr.png) ```= sort 檔案名 //總排序 sort -r 檔案名 //反排序 man sort man -f 檔案 q //跳出man ``` 查詢top5 第三欄 第四欄 ``` awk -F "," '{ print $3, $4 }' workers.csv | sort -k 3 //這其實是根據姓名 -k 3是第三欄 awk -F "," '{ print $3, $4 }' workers.csv | sort -k 3 -n //順序低到高 awk -F "," '{ print $3, $4 }' workers.csv | sort -k 3 -n -r //順序正確 awk -F "," '{ print $3, $4 }' workers.csv | sort -k 3 -n -r -u //單獨的 awk -F "," '{ print $3, $4 }' workers.csv | sort -k 3 -n -r -u | head -5 //只要top5 awk -F "," '{ print $3, $4 }' workers.csv | sort -r -k 3 -n | head -5 > top5.txt //把這5個夾在新檔案中 查看 ls 看檔案內容 cat top5.txt ``` :::success 總排序 sort workers.csv ![](https://i.imgur.com/1LXL2be.png) 只要5個 awk -F "," '{ print $3, $4 }' workers.csv | sort -r -k 3 -n | head -5 ![](https://i.imgur.com/y8ms1jP.png) 把這5個建立在新檔案中 awk -F "," '{ print $3, $4 }' workers.csv | sort -r -k 3 -n | head -5 > topnew.txt ![](https://i.imgur.com/P3hU8yH.png) [參考Youtube](https://www.youtube.com/watch?v=9j0h3qf73jI) ::: <font color="#8A2BE2">[W1]</font> Command Line Intermediate === # 11. Customizing Bash ![](https://i.imgur.com/zr9gM7X.png) ![](https://i.imgur.com/oRgtj3u.png) :::success mac 的 default 就是shell ::: ```= ls -a ls -al vim .bash_profile //我好像不行X open .bash_profile //開始編輯 ``` ![](https://i.imgur.com/YbNCh3C.png) 課程 ![](https://i.imgur.com/4KPqx7O.png) ![](https://i.imgur.com/QiM69MB.png) ## 我的 open .bash_profile //開始編輯快捷鍵 ![](https://i.imgur.com/2yL3QHo.png) # 12 Diff ```= cat 檔案名.檔案格式 //終端機內開啟檔案 diff a.txt b.txt //比較檔案 diff -p a.txt b.txt //比較檔案 好讀 diff -p a.txt b.txt > a.patch //b蓋過a檔案 patch < a.patch //運行patch cat a.txt ``` 比較檔案 不好讀 diff a.txt b.txt ![](https://i.imgur.com/Sop1u4M.png) 比較檔案 好讀 diff -p a.txt b.txt ![](https://i.imgur.com/OvxRqwD.png) b覆蓋a,a檔案目前的內容 diff -p a.txt b.txt > a.patch patch < a.patch cat a.txt ![](https://i.imgur.com/osU1KSq.png) # 13. Challenge: Undoing a Bad Patch 挑戰目標:patch 後發現不要這些改變,返回之前的patch(undo patch) ![](https://i.imgur.com/VKIigsK.png) ```= patch -R < a.patch //重新回覆 覆蓋之前的patch cat a.txt //重新開啟a.txt檔案 ``` ![](https://i.imgur.com/Dq7F86P.png) # 14. File System | | | | | -------- | -------- | -------- | | ![](https://i.imgur.com/iINW42M.png)|![](https://i.imgur.com/JGsMNEc.png)| | Soft link 有點像是指標 舉例softLink.txt 不像hardLink.txt直接指向 ```= mkdir files //建立資料夾 cd files/ //進入資料夾 touch hi.txt //建立一般純文字檔 hi.txt ls -lh //查看目前 ln -s hi.txt hi_sym.txt //soft link hi.txt檔案,指向hi_sym.txt ll //查看目前 ll是ls -lh 看快捷鍵 ln hi.txt hi2.txt //hard link hi2.txt ls -i //查看細節 ``` :::success ![](https://i.imgur.com/uUiukLh.png) ![](https://i.imgur.com/7kPTZQz.png) ![](https://i.imgur.com/YLpsJE8.png) ::: # 15. File Permissions ## 檔案符號 ![](https://i.imgur.com/xKU5yJ4.png) ## owner read write 別人不行操作 ```= r re permission w write permission x executable permission - do not have permission ``` ```= chmod 600 hi.txt //6 110 rw- 0 ---- 0 ---- ll //-rw------ 二進位的6是 110 二進位的0是 --- 二進位的0是 --- ``` ![](https://i.imgur.com/8nmtBgv.png) ## 每個人都有權限 ```= chmod 777 hi.txt ll //-rwxrwxrwx會看到是可以read write ``` ![](https://i.imgur.com/4y1lpdB.png) ## 改變使用者從bob變成別人 ```= chown joy hi.txt //不允許 sudo chown joy hi.txt //打完密碼,就允許 ll cat hi.txt //因為使用者是別人,-rw------是打不開的 sudo hi.txt //強制打開 ``` ![](https://i.imgur.com/qi5XYBr.png) ![](https://i.imgur.com/rHwF6kY.png) ![](https://i.imgur.com/VYU2Ukq.png) ```= chmod 600 hi.txt //6 110 rw- 0 ---- 0 ---- ll //-rw------不能讀、改寫 chmod 777 hi.txt ll //-rwxrwxrwx 可以讀、改寫 chmod 600 hi.txt //改回不能讀、改寫 chown root hi.txt //改使用者,被電腦駁回 sudo chown root hi.txt //強制改使用者 ll cat hi.txt //不能開啟檔 sudo cat hi.txt //強制開啟檔案,成功,沒有阻止 ``` # 16. Bash Scripting: Tests and Ifs ## 用script印出變數程式碼 ```= 開啟shell vi script.sh ``` ```= script內部做編輯 A=10 //建立A變數 值是10 B=2 //建立B變數 值是2 C="This is interpolation A = $A" //字串與變數 D='This is not B!= $B' //全部都是字串 echo $C //印出C變數 echo $D //印出D變數 ``` ![](https://i.imgur.com/T58149q.png) > 從vim bash script跳出 (先按esc ->:q ->enter鍵) > * 結束: :q > * 存檔後結束: :wq >> 如果出現紅字說No write since last change (add ! to override) 如何退出,如何编辑保存? >>>这种情况下,多半是没有权限造成的,没有write的权限。 > 退出方法:ctrl+z > ```= 再次開啟shell sh script.sh //會印出剛剛的變數C This is interpolation A = 10 //會印出剛剛的變數D This is not B!= $B ``` ![](https://i.imgur.com/KR4uveA.png) ## script印出比大小 ```= E=4 [ $E -gt 2 ] //方法1 gt代表greater echo $? //0 印出0代表成功,印出其他代表失敗 [[ $E -gt 2 ]] //方法2 echo $? //0 印出0代表成功,印出其他代表失敗 ``` ![](https://i.imgur.com/EVf7U3u.png) > 盡量使用[[ ]] 因為單是單一括號[]的修正版 ## script印出 if elif else ```= vi script.sh //再次進入script if [[ -e cattable ]] //if 如果檔案cattable在的話 輸出0 then cat cattable elif [[ $B -gt $A ]] //else if B比A大 then echo "At least $B is greater than $A" else //else echo "All rest have failed" fi //結束 ``` ![](https://i.imgur.com/Y6ceIyB.png) ```= 執行script sh script.sh //上述if elif都不成立進入到else進出 ``` ![](https://i.imgur.com/cGJO2iW.png) # 17. Bash Scripting: Loops and Switches ## for loop範例1 ### vim script 建立五個檔案 ```= vim script.sh for (( i=0; i<5; i++ )) do touch "new_file_$i.txt" //建立出new_file_$0.txt new_file_$1.txt new_file_$2.txt 等等 echo "File number $i was created..." //印出 done ``` ![](https://i.imgur.com/nuLjIUs.png) ### shell run script ```= sh script.sh ls ``` ![](https://i.imgur.com/b7rMewf.png) ## for loop範例2 ### 寫script ```= vi script.sh //再次進入script寫 for new_file in $(ls new_file_*) //loop所有檔案名字是new_file_*的 do echo $new_file //印出所有檔名是 new_file的資料 done ``` ![](https://i.imgur.com/8MfCdSH.png) ### shell run script ```= sh script.sh //執行script ``` ![](https://i.imgur.com/QThjaK9.png) ## While loop範例 ### 寫script ```= vi script.sh while getopts "ab:" opt //getots把所有的選項都傳出來,字串ab,在找a 找b do case "$opt" in a) echo "The -a flag was used" ;; //印出字串 b) echo "The -b flag was used with ${OPTARG}" ;; //印出字串+變數 esac //case反過來寫 esac done ``` > 什麼都不會印出來 ![](https://i.imgur.com/mxvYpIi.png) ### run script ```= sh script.sh sh script.sh -a //印出The -a flag was used sh script.sh -a -b "hi" //印出The -a flag was used //印出The -b flag was used with hi ``` > -a ![](https://i.imgur.com/7XINnGD.png) > -b ![](https://i.imgur.com/gvYfWXW.png) > 全部 ![](https://i.imgur.com/6txYrYN.png) ## getopts 使用參數 :::danger getopts 是用參數的意思 ![](https://i.imgur.com/GiPTYsq.png) ![](https://i.imgur.com/bPavT5q.png) ::: # 18. Bash Scripting: Functions ## 函式範例一 印出函式字串Hi ## shell 進入 script ```= vi function.sh ``` ## bash裡寫 script ```= function hi { echo "Hello from a function!"; } hi ``` ![](https://i.imgur.com/fGVggkt.png) ## shell 執行 script ```= sh function.sh ``` ![](https://i.imgur.com/aBs6Cta.png) ## 函式範例二 印出函式字串並加上參數 Hi Johnny ## shell 進入 script ```= vi functions.sh ``` ## bash裡寫 script ```= function hi { echo "Hello to $1 from a function!"; } hi "Johnny" ``` ![](https://i.imgur.com/cznR3nc.png) ## shell 執行 script ```= sh function.sh ``` ![](https://i.imgur.com/wQZOHcH.png) # 19. Automating Your Job 題目:做一個script packager 目標:把icons檔案夾裡面的照片png檔案,移到packaged_images檔案夾裡面的子檔案夾 ![](https://i.imgur.com/OB6M2LX.png) ## PART1 ### 開啟vi ```= cd automating_your_job/ vi packager.sh ``` ### 寫入script ```= while getopts "d:" opt //d是參數 do case "$opt" in d) DIR=${OPTARG};; //OPTARG是參數賦值給 變數DIR esac done if [[ $DIR == '' ]] //如果使用者沒有傳東西 then echo "Please provide an image directory." //文字告訴 exit 1; fi ``` ### 執行script ```= sh packager.sh ls sh packager.sh icons/ //傳入檔案夾的檔名是icons sh packager.sh -d icons/ //-d參數 icons檔案夾的檔名icons ``` ![](https://i.imgur.com/K0Fxvzu.png) ## PART2 ### 開啟vi ```= vi function.sh ``` ### 寫入script ```= # Create new directory with result RESULTS_DIR="packaged_images" //路徑賦值給 變數RESULTS_DIR mkdir $RESULTS_DIR //建立一個檔案夾檔名是packaged_images for IMAGE in $(ls $DIR) do FIRST_LETTER=${IMAGE:0:1} //檔名0~1之間英文字賦值給 變數FIRST_LETTER TARGET_DIR="$RESULTS_DIR/$FIRST_LETTER" //照片/0-1英文字賦值給 變數TARGET_DIR if [[ -d $TARGET_DIR ]] //如果存在 then echo "Directory $TARGET_DIR already exists." else //如果不存在 mkdir $TARGET_DIR //建立 echo "Created $TARGET_DIR" //印出 fi //finally cp "$DIR/$IMAGE" "$TARGET_DIR/$IMAGE" //可以copy照片 到該處 done ``` ![](https://i.imgur.com/lnPV7oH.png) ## 執行script ```= sh packager.sh -d icons/ //因為沒有資料夾,所以會建立出f h r s t 資料夾 ``` 原本 ![](https://i.imgur.com/Nj0wgE1.png =80%x) 後來 ![](https://i.imgur.com/OtqDued.png =80%x) ## 開啟finder查看 ```= open . ``` # 20. Challenge: Automating Your Job - Refactoring ![](https://i.imgur.com/v7VmrS0.png) ![](https://i.imgur.com/WJsMkV7.png) ![](https://i.imgur.com/f5pkmD2.png) 自行測試<報錯> ![](https://i.imgur.com/07pZ9fk.png) ![](https://i.imgur.com/YYJvsFG.png) ```= function makeDirectoryIfNecessary { if [[ -d $1 ]] //如果存在 then echo "Directory $1 already exists." else //如果不存在 mkdir $1 //建立 echo "Created $1" //印出 } while getopts "d:" opt //d是參數 do case "$opt" in d) DIR=${OPTARG};; //OPTARG是參數賦值給 變數DIR esac done if [[ $DIR == '' ]] //如果使用者沒有傳東西 then echo "Please provide an image directory." //文字告訴 exit 1; fi # Create new directory with result RESULTS_DIR="packaged_images" //路徑賦值給 變數RESULTS_DIR mkdir $RESULTS_DIR //建立一個檔案夾檔名是packaged_images for IMAGE in $(ls $DIR) do FIRST_LETTER=${IMAGE:0:1} //檔名0~1之間英文字賦值給 變數FIRST_LETTER TARGET_DIR="$RESULTS_DIR/$FIRST_LETTER" //照片/0-1英文字賦值給 變數TARGET_DIR makeDirectoryIfNecessary $TARGET_DIR //呼叫函式 fi //finally cp "$DIR/$IMAGE" "$TARGET_DIR/$IMAGE" //可以copy照片 到該處 done ``` :::danger 未使用函式 ![](https://i.imgur.com/WJsMkV7.png) 使用函式 ![](https://i.imgur.com/L4WYU2x.png) ::: ## 刪除已建立檔案重新呼叫一次 ```= rm -rf package_images //刪除 sh packager.sh -d icons/ //執行 open . //finder開啟 ``` # 21. Conclusion | | | | | -------- | -------- | -------- | | ![](https://i.imgur.com/BwoAcgZ.png)|![](https://i.imgur.com/a9Ipk2V.png) | | [胡立學生分享 第一週git](https://yakimhsu.com/project/project_w1_CommandLine.html) ###### tags: `[Kodeco IOS]`

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully