Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Shell scripting 基本教學
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Alex
March 04, 2019
Technology
0
41
Shell scripting 基本教學
Alex
March 04, 2019
Tweet
Share
More Decks by Alex
See All by Alex
How to integrate GitLab CICD into B2B service.pdf
alexsu
0
290
Jenkins Quick Guide
alexsu
0
130
Vim 基本操作
alexsu
1
110
Top IDEs & Code Editors for Data Science
alexsu
0
44
Linux_Command-line_指令與基本操作.pdf
alexsu
0
87
Introduction to Git for Data Science
alexsu
0
280
Other Decks in Technology
See All in Technology
StrandsとNeptuneを使ってナレッジグラフを構築する
yakumo
1
120
OpenShiftでllm-dを動かそう!
jpishikawa
0
110
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
190
Agile Leadership Summit Keynote 2026
m_seki
1
620
変化するコーディングエージェントとの現実的な付き合い方 〜Cursor安定択説と、ツールに依存しない「資産」〜
empitsu
4
1.4k
登壇駆動学習のすすめ — CfPのネタの見つけ方と書くときに意識していること
bicstone
3
110
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
590
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
230
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
140
今日から始めるAmazon Bedrock AgentCore
har1101
4
410
Azure Durable Functions で作った NL2SQL Agent の精度向上に取り組んだ話/jat08
thara0402
0
190
SREじゃなかった僕らがenablingを通じて「SRE実践者」になるまでのリアル / SRE Kaigi 2026
aeonpeople
6
2.4k
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Designing for humans not robots
tammielis
254
26k
Odyssey Design
rkendrick25
PRO
1
500
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.3k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
How to Talk to Developers About Accessibility
jct
2
130
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
93
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
96
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