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
140
bashの組み込みコマンドの自作
以下動画のテキストです
https://youtu.be/wXgkrMsxYqk
Satoru Takeuchi
PRO
June 24, 2022
Tweet
Share
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
「Linux」という言葉が指すもの
sat
PRO
3
95
APIとABIの違い
sat
PRO
5
62
ファイルシステムへのアクセス方法
sat
PRO
0
26
ファイルシステム
sat
PRO
1
34
低レイヤソフトウェア技術者が YouTuberとして食っていこうとした話
sat
PRO
7
6.1k
ポーリングと割り込み
sat
PRO
1
80
Rook: Intro and Deep Dive With Ceph
sat
PRO
1
140
会社員しながら本を書いてきた知見の共有
sat
PRO
3
880
デバイスにアクセスするデバイスファイル
sat
PRO
1
62
Other Decks in Technology
See All in Technology
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
20
9.7k
20250910_障害注入から効率的復旧へ_カオスエンジニアリング_生成AIで考えるAWS障害対応.pdf
sh_fk2
3
230
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
380
[ JAWS-UG 東京 CommunityBuilders Night #2 ]SlackとAmazon Q Developerで 運用効率化を模索する
sh_fk2
3
380
EncryptedSharedPreferences が deprecated になっちゃった!どうしよう! / Oh no! EncryptedSharedPreferences has been deprecated! What should I do?
yanzm
0
220
バッチ処理で悩むバックエンドエンジニアに捧げるAWS Glue入門
diggymo
3
190
【実演版】カンファレンス登壇者・スタッフにこそ知ってほしいマイクの使い方 / 大吉祥寺.pm 2025
arthur1
1
770
LLMを搭載したプロダクトの品質保証の模索と学び
qa
0
1k
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.6k
Rustから学ぶ 非同期処理の仕組み
skanehira
1
130
実践!カスタムインストラクション&スラッシュコマンド
puku0x
0
350
ZOZOマッチのアーキテクチャと技術構成
zozotech
PRO
3
1.5k
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Side Projects
sachag
455
43k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Building Applications with DynamoDB
mza
96
6.6k
Embracing the Ebb and Flow
colly
87
4.8k
A designer walks into a library…
pauljervisheath
207
24k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
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/