summaryrefslogtreecommitdiffstats
path: root/noise
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-09 15:52:40 +0200
committertv <tv@xso>2011-09-09 15:52:40 +0200
commit630c7d80d48d0ebfe30c2a84d8b887e6b029bc83 (patch)
treeb21602356b3a4599a6ee0ae11d9fa0a58e577a33 /noise
parentc6d5e62104ed4ab76cc8d90979fa7a64f67c8c47 (diff)
//noise: use BRE @sed
Diffstat (limited to 'noise')
-rwxr-xr-xnoise/noise22
1 files changed, 12 insertions, 10 deletions
diff --git a/noise/noise b/noise/noise
index bd6b17c8..99a08023 100755
--- a/noise/noise
+++ b/noise/noise
@@ -7,8 +7,8 @@ noise_set() { # set a variable
esac
case $# in
(0) ## print all noise variables
- env | sed -rn '
- s/^noise_([[:alnum:]_]+)=(.*)$/\1 = \2/p
+ env | sed -n '
+ s/^noise_\([[:alnum:]_]\+\)=\(.*\)$/\1 = \2/p
' | sort
;;
(1) ## print value the specified variable
@@ -31,7 +31,9 @@ noise_set() { # set a variable
fi
## write variable to $env
if grep -q "^$1=" "$env" ; then
- sed -ri "s'^($1)=(.*)\$'\1=\'$2\''" $env
+ env_cache="`cat $env`"
+ echo "$env_cache" |
+ sed "s'^\($1\)=\(.*\)\$'\1=\'$2\''" > $env
else
echo "$1='$2'" >>$env
fi
@@ -90,13 +92,13 @@ touch $env
##
##
readline() {
- { read REPLY && echo "$REPLY" ; } | sed -rn "
+ { read REPLY && echo "$REPLY" ; } | sed -n "
s/[']//g
s/~%/\n/g
- s/([^\\])([#<>])/\1\\\\\2/g
- s:^/([a-z_]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t
- s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t
- s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t
+ s/\([^\\]\)\([#<>]\)/\1\\\\\2/g
+ s:^/\([a-z_]\+\)\([[:space:]]\+\(.*\)\)\?$:command=\1; args='\3';:p;t
+ s@^\([[:alnum:]_/+-]\+\):[[:space:]]*\(.*\)@command=lang; args='\1 \2';@p;t
+ s@^\![[:space:]]*\(.*\)@command=play; args='\1';@p;t
s:.*:command='$noise_default_command'; args='&';:p;t
"
}
@@ -137,8 +139,8 @@ commit `

Join the 23.shack-dev-team, we've got `
sloccount $dirname/* |
- sed -rn '
- s/.*\(SLOC\)[[:space:]]*=[[:space:]]*([0-9]+)$/\1/p
+ sed -n '
+ s/.*(SLOC)[[:space:]]*=[[:space:]]*\([0-9]\+\)$/\1/p
'` SLOC, `
{
ls $dirname/modules/