Next: , Previous: Rename files to lower case, Up: Examples   [Contents][Index]


4.4 bash¤Î´Ä¶­ÊÑ¿ô¤Î½ÐÎÏ

°Ê²¼¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¤set Bourne¥·¥§¥ë¥³¥Þ¥ó¥É¤Î½ÐÎϤ«¤é¡¤¥·¥§¥ë´Ø ¿ô¤ÎÄêµÁ¤ò¼è¤ê½ü¤­¤Þ¤¹¡¥

#!/bin/sh

set | sed -n '
:x
# if no occurrence of ‘=()’ print and load next line
/=()/! { p; b; }
/ () $/! { p; b; }
# possible start of functions section
# save the line in case this is a var like FOO="() "
h
# if the next line has a brace, we quit because
# nothing comes after functions
n
/^{/ q
# print the old line
x; p
# work on the new line now
x; bx
'