Skip to content

Instantly share code, notes, and snippets.

@knjname
Last active December 20, 2015 17:09
Show Gist options
  • Select an option

  • Save knjname/6166459 to your computer and use it in GitHub Desktop.

Select an option

Save knjname/6166459 to your computer and use it in GitHub Desktop.
名前付きパイプを適当に使ってみよう!
#!/bin/bash
# named pipe 生成!
mkfifo hoge_pipe
# 実際にそのファイルが存在している
ls -l hoge_pipe
# named pipe からの入力の行数を測るようにセッティング
wc -l < hoge_pipe &
# named pipe に入力を与えてやる => 100を表示して wc -l < hoge_pipe & は終了
yes | head -100 > hoge_pipe
# まだファイルは存在している
ls -l hoge_pipe
# ファイルは消すことが可能
# rm hoge_pipe
# 削除しないままプロセスが完了してもファイルは存在しつづける
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment