Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
bashの組み込みコマンドの自作
Search
Satoru Takeuchi
PRO
June 24, 2022
Technology
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
bashの組み込みコマンドの自作
以下動画のテキストです
https://youtu.be/wXgkrMsxYqk
Satoru Takeuchi
PRO
June 24, 2022
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
70
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
98
あなたの知らないバージョン命名規則
sat
PRO
3
910
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
64
Machine Check Exception
sat
PRO
2
67
バイナリダンプの模様を読む
sat
PRO
0
91
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
91
114-ファイルのshallow_copy.pdf
sat
PRO
2
58
113-Btrfsのスナップショット.pdf
sat
PRO
0
42
Other Decks in Technology
See All in Technology
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
910
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
970
覗いてみよう 関数型ビジュアル言語×2Dグラフィックスの世界
yohyamasaki
0
150
Argo CDとAtlantisで実現するインフラ管理のセルフサービス化──小規模SREチームで支えるプラットフォーム
cassius7
0
240
The kernel report
ennael
PRO
1
130
PQC移行の今 -- IETF からみた現在地
satokan
4
620
10年欲しかった音楽管理アプリを、AIと一緒に作りはじめた
judau
1
180
「大丈夫そう?」をObservabilityで確かめる
mrmtsu
0
230
猫でもわかるKiro Web
kentapapa
1
150
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
140
Lambda MicroVMsは常駐サーバーの代わりに なるか? Kiro Crew を動かして検証してみた / Kiro Crew on Lambda MicroVMs
k_adachi_01
2
340
AWS DevOps Agent スキルをつかいこなそう / Master AWS DevOps Agent Skills
kinunori
2
620
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Designing Experiences People Love
moore
143
24k
Done Done
chrislema
187
17k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
720
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
A Tale of Four Properties
chriscoyier
163
24k
Become a Pro
speakerdeck
PRO
31
6.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Site-Speed That Sticks
csswizardry
13
1.5k
Designing Powerful Visuals for Engaging Learning
tmiket
1
580
Building Adaptive Systems
keathley
44
3.2k
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/