diary/Kojima/2006-08-02
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[diary/Kojima]]
・bash の =~~
授業で使えるかな,と fedora core5 の /etc/rc.d/rc.sysinit...
# Print a text banner.
echo -en $"\t\tWelcome to "
read -r redhat_release < /etc/redhat-release
if [[ "$redhat_release" =~ "Red Hat" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m"
echo -en "Red Hat"
なんて表現を発見.=~ は文字列のパターンマッチみたいなんだ...
にこんな機能あったっけ?」と bash のマニュアルをあれこれ...
それらしい記述は見当たらず.
よく分からんなぁ,,と,手元の /usr/share/doc/bash/NEWS.g...
"New Features in Bash" として
cc. The [[ ... ]] command has a new binary `=~' operator...
extended regular expression (egrep-like) matching.
dd. `configure' has a new `--enable-cond-regexp' option ...
to enable the =~ operator and regexp matching in [[ ...
ee. Subexpressions matched by the =~ operator are placed...
BASH_REMATCH array variable.
なんてのが上げられていて,bash-3.0 の新機能なのか,という...
確かに条件式の中で文字列のパターンマッチが書けるのはすご...
けど,bash-3.0 以上限定になるというのはちょっと悩ましいと...
#comment
終了行:
[[diary/Kojima]]
・bash の =~~
授業で使えるかな,と fedora core5 の /etc/rc.d/rc.sysinit...
# Print a text banner.
echo -en $"\t\tWelcome to "
read -r redhat_release < /etc/redhat-release
if [[ "$redhat_release" =~ "Red Hat" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m"
echo -en "Red Hat"
なんて表現を発見.=~ は文字列のパターンマッチみたいなんだ...
にこんな機能あったっけ?」と bash のマニュアルをあれこれ...
それらしい記述は見当たらず.
よく分からんなぁ,,と,手元の /usr/share/doc/bash/NEWS.g...
"New Features in Bash" として
cc. The [[ ... ]] command has a new binary `=~' operator...
extended regular expression (egrep-like) matching.
dd. `configure' has a new `--enable-cond-regexp' option ...
to enable the =~ operator and regexp matching in [[ ...
ee. Subexpressions matched by the =~ operator are placed...
BASH_REMATCH array variable.
なんてのが上げられていて,bash-3.0 の新機能なのか,という...
確かに条件式の中で文字列のパターンマッチが書けるのはすご...
けど,bash-3.0 以上限定になるというのはちょっと悩ましいと...
#comment
ページ名: