112
回編集
M (→パイプイン) |
M (→ビルトインのread) |
||
==入力/出力==
===ビルトインのread===
read: read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]<br />
Read a line from the standard input and split it into fields.
read はユーザーの入力や標準入力またはパイプからの読み込みのためのツールです。
ユーザー入力の例:
<source lang=bash>
# 'readline' prompt default variable name
echo "$command"</source>
それをよりシンプルにした例:
<source lang=bash>pause() { read -n 1 -p "Press any key to continue..."; }</source>
Hello-world
<source lang=bash>echo 'Hello, world!' | { read hello
echo $hello }</source>
|
回編集