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
bashの組み込みコマンドの自作
Search
Satoru Takeuchi
PRO
June 24, 2022
Technology
160
0
Share
bashの組み込みコマンドの自作
以下動画のテキストです
https://youtu.be/wXgkrMsxYqk
Satoru Takeuchi
PRO
June 24, 2022
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
小学校5,6年生向けキャリア教育 大人になるまでの道
sat
PRO
8
3.4k
ファイルシステムの不整合
sat
PRO
2
130
書籍執筆での生成AIの活用
sat
PRO
2
440
ChatGPTに従って体調管理2026
sat
PRO
0
170
eBPF
sat
PRO
1
140
waruiBPF
sat
PRO
0
120
eBPFとwaruiBPF
sat
PRO
5
4.4k
Pythonのコードの気になる行でスタックトレースを出す
sat
PRO
1
110
ソースコードを読むときの思考プロセスの例 ~markdownのレンダリング方法を知りたかった2 markdownパッケージ~
sat
PRO
0
220
Other Decks in Technology
See All in Technology
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
250
LLMに何を任せ、何を任せないか
cap120
11
6.7k
ハーネスエンジニアリング×AI適応開発
aictokamiya
1
910
AgentCoreとLINEを使った飲食店おすすめアプリを作ってみた
yakumo
2
270
出版記念イベントin大阪「書籍紹介&私がよく使うMCPサーバー3選と社内で安全に活用する方法」
kintotechdev
0
120
GitHub Advanced Security × Defender for Cloudで開発とSecOpsのサイロを超える: コードとクラウドをつなぐ、開発プラットフォームのセキュリティ
yuriemori
1
120
Podcast配信で広がったアウトプットの輪~70人と音声発信してきた7年間~/outputconf_01
fortegp05
0
140
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.3k
OpenClawでPM業務を自動化
knishioka
2
350
Databricks Appsで実現する社内向けAIアプリ開発の効率化
r_miura
0
160
互換性のある(らしい)DBへの移行など考えるにあたってたいへんざっくり
sejima
PRO
0
480
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
160
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
500
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
Google's AI Overviews - The New Search
badams
0
950
Designing Powerful Visuals for Engaging Learning
tmiket
1
320
Bash Introduction
62gerente
615
210k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
Facilitating Awesome Meetings
lara
57
6.8k
From π to Pie charts
rasagy
0
160
Producing Creativity
orderedlist
PRO
348
40k
Making Projects Easy
brettharned
120
6.6k
Transcript
bashの組み込みコマンドを自作 Jun. 24th, 2022 Satoru Takeuchi twitter: satoru_takeuchi
おさらい: bashの組み込みコマンドとは • 📝 過去動画: bashの組み込みコマンドより抜粋 ◦ https://youtu.be/6oVvcnwRUa0 • bash上で”help”を実行すると出てくるコマンドたち
• 新規プロセスを生成せずにbash自身が処理
bashの組み込みコマンドは自作できる • 必要なパッケージ(Ubuntu 20.04を想定) ◦ bash-builtins • 開発言語 ◦ C言語
helloと出力する組み込みコマンドを作る • ソースの場所 ◦ https://github.com/satoru-takeuchi/youtube-sample/tree/master/0042-create-bash-builtin-commands • ビルド方法 ◦ make •
組み込み方法 ◦ enable -f ./myhello.so myhello • 実行ファイル形式のコマンドとの性能比較 ◦ ./bench.sh
組み込みコマンド自作機能についての私見 • 面白いけど、あまり使う場面はなさそう • 性能向上するケースが限られる ◦ コマンド実行コストのほとんどがプロセスの生成コスト ◦ コマンドが大量に呼ばれる •
C言語のソースを書いてメンテするのが面倒 • 使う前にいちいち組み込むのが面倒
まとめ • bashの組み込みコマンドは自作できる • 面白いが使い道は限られる • 📝 興味ある方はbash-builtinsのドキュメントを参照 ◦ /usr/share/doc/bash-builtins/examples/