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
0
160
bashの組み込みコマンドの自作
以下動画のテキストです
https://youtu.be/wXgkrMsxYqk
Satoru Takeuchi
PRO
June 24, 2022
Tweet
Share
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.3k
Pythonのコードの気になる行でスタックトレースを出す
sat
PRO
1
110
ソースコードを読むときの思考プロセスの例 ~markdownのレンダリング方法を知りたかった2 markdownパッケージ~
sat
PRO
0
220
Other Decks in Technology
See All in Technology
俺の/私の最強アーキテクチャ決定戦開催 ― チームで新しいアーキテクチャに適合していくために / 20260322 Naoki Takahashi
shift_evolve
PRO
1
480
タスク管理も1on1も、もう「管理」じゃない - KiroとBedrock AgentCoreで変わった“判断の仕事”
yusukeshimizu
0
150
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
220
SaaSの操作主体は人間からAIへ - 経理AIエージェントが目指す深い自動化
nishihira
0
120
スケーリングを封じられたEC2を救いたい
senseofunity129
0
120
Embeddings : Symfony AI en pratique
lyrixx
0
430
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
160
ハーネスエンジニアリング×AI適応開発
aictokamiya
1
800
Cursor Subagentsはいいぞ
yug1224
2
120
Why we keep our community?
kawaguti
PRO
0
340
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
0
350
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
160
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Crafting Experiences
bethany
1
97
Rails Girls Zürich Keynote
gr2m
96
14k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
420
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
500
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
220
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
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/