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
110
bashの組み込みコマンドの自作
以下動画のテキストです
https://youtu.be/wXgkrMsxYqk
Satoru Takeuchi
PRO
June 24, 2022
Tweet
Share
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
KubeConにproposalを送りたい人へのアドバイス
sat
PRO
3
210
俺とキャンプ2
sat
PRO
1
95
俺とキャンプ3
sat
PRO
0
81
データ冗長化のしくみRAID 基礎概念とRAID1編
sat
PRO
2
24
RAIDの実現方法
sat
PRO
2
53
Linux環境のCPU上で10ミリ秒間に起こること
sat
PRO
3
110
HDDへのアクセス速度は位置によって変わる!??
sat
PRO
4
53
ボリュームマネージャLVM
sat
PRO
2
87
Best Practices of Production-Grade Rook/Ceph Cluster
sat
PRO
1
1.9k
Other Decks in Technology
See All in Technology
少数チームで挑む: SwiftUI, TCA, KMPを用いた 新規動画配信アプリ 「ABEMA Live」の開発について
tomu28
0
620
Databricks:『生成AI World Cup』のご案内
databricksjapan
2
170
エンジニアのキャリアをちょっと楽しくする3本の軸/Three Pillars to Make an Engineer's Career More Enjoyable
kwappa
0
2.6k
Postman v10リリース後を振り返る
nagix
0
170
元インフラエンジニアに成る / Human Resources to Human Relations
bobtani
4
890
Cracking the KubeCon CfP
inductor
2
210
どうするコスト最適化のトレードオフ
tetsuyaooooo
1
470
Janus
bkuhlmann
1
490
Databricks における 『MLOps』
databricksjapan
2
160
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
1.2k
NgRx Signal Store
rainerhahnekamp
0
140
反実仮想機械学習とは何か
usaito
PRO
8
3k
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
67
8.6k
Six Lessons from altMBA
skipperchong
20
3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.5k
How to name files
jennybc
64
93k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
77
42k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
Fantastic passwords and where to find them - at NoRuKo
philnash
36
2.5k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
Fireside Chat
paigeccino
20
2.6k
4 Signs Your Business is Dying
shpigford
175
21k
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/