Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Shell scripting 基本教學
Search
Alex
March 04, 2019
Technology
50
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Shell scripting 基本教學
Alex
March 04, 2019
More Decks by Alex
See All by Alex
How to integrate GitLab CICD into B2B service.pdf
alexsu
0
310
Jenkins Quick Guide
alexsu
0
140
Vim 基本操作
alexsu
1
150
Top IDEs & Code Editors for Data Science
alexsu
0
46
Linux_Command-line_指令與基本操作.pdf
alexsu
0
130
Introduction to Git for Data Science
alexsu
0
300
Other Decks in Technology
See All in Technology
Rustuna: Rustによる高速なOptuna実装
pfn
PRO
0
190
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
6
4.9k
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
しろおびから始める!ログ活用の第一歩
shumei_ito
0
950
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
490
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
770
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
Kiro Crewをはじめよう
kizawa2020
1
160
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
420
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
120
Refining Active Record
shugo
0
150
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
It's Worth the Effort
3n
188
29k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Designing for humans not robots
tammielis
254
26k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Code Reviewing Like a Champion
maltzj
529
40k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Transcript
Shell scripting 基本教學 蘇民弦 (Alex)
為什麼要學 Shell Scripting 1. 程式自動化 2. 利用程式邏輯管理電腦和工作程序 3. 減少單一重複的動作
步驟 1. 建立一個 shell script (.sh) 2. 撰寫 Shell Scripting
程式 3. 執行程式 `$ sh scripting.sh` 4. 或搭配 crontab 自動化
#!bin/bash # 聲明用哪個 Shell echo “Hello World” # 印出 “Hello
World” 字串 mkdir MyFolder # 建立一個資料夾 touch ./MyFolder/file.r # 在這個資料夾新增一個 file.r 檔案 撰寫第一個 Shell Scripting 腳本
預設環境變數 echo $SHELL # 目前使用的 shell echo $PATH # 路徑
echo $USER # 使用者 echo $HOME # 家目錄路徑 echo $HOSTNAME # 主機名稱
自訂變數 a=100 b=50 c=”Hello World!” echo $a # 呼叫變數,前面一定要加一個 $
echo $c
四則運算 x=50 y=10 a=`expr $x + $y` # 加法 b=`expr
$x - $y` # 減法 c=`expr $x \* $y` # 乘法 d=`expr $x / $y` # 除法 e=`expr $x % $y` # 餘數
迴圈 (loop) 1 加到 10 的小程式
迴圈 (while) 1 加到 10 的小程式
判斷式 (if else) 比大小程式
資料庫備份小程式 Shell Scripting 範例
練習 • 寫一個監控自己電腦的程式 • 寫一個自動在 5/1 寄給自己,提醒鳳梨罐頭已經過期的信 • 搭配先前學到的處理字串的技巧,練習在 Shell
處理資料 • 寫一個自動安裝程式的 scripts