mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Use correct ranges with tr
The tr command does not take regular expressions and should not be used with ranges such as [a-z] which furthermore can cause issues if unquoted as they are interpreted by the shell.
This commit is contained in:
parent
aba742a5e7
commit
8816c26e2a
6 changed files with 10 additions and 10 deletions
|
|
@ -33,7 +33,7 @@ exec_class_log() {
|
|||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 8;;
|
||||
|
|
@ -55,7 +55,7 @@ get_priority() {
|
|||
}
|
||||
|
||||
get_mark() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo "0x41/0x3df";;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ exec_log() {
|
|||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
|
|
@ -98,7 +98,7 @@ manage_rule() {
|
|||
return 1;
|
||||
}
|
||||
|
||||
protocol=$(echo ${proto}|tr [A-Z] [a-z])
|
||||
protocol=$(echo ${proto}|tr 'A-Z' 'a-z')
|
||||
prio_num=$(get_priority ${priority})
|
||||
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
||||
for p in ${port}; do
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ exec_log() {
|
|||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ zone_name=$(uci -c /var/state -q get cwmp.acs.zonename)
|
|||
port=$(uci -q get cwmp.cpe.port)
|
||||
ipaddr=$(uci -c /var/state -q get cwmp.acs.ip)
|
||||
ip6addr=$(uci -c /var/state -q get cwmp.acs.ip6)
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr [A-Z] [a-z])
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr 'A-Z' 'a-z')
|
||||
|
||||
if [ "$zone_name" = "" ]; then
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -289,8 +289,8 @@ parser_timeout()
|
|||
#data format is digital with time unit
|
||||
#10s-10 seconds 10m-10 minutes 10h-10 hours 10d-10 days
|
||||
if [ -n "$1" ]; then
|
||||
flag=$(echo "$1"| tr -d [0-9] | tr '[A-Z]' '[a-z]')
|
||||
data=$(echo "$1"| tr -cd [0-9])
|
||||
flag=$(echo "$1"| tr -d '0-9' | tr 'A-Z' 'a-z')
|
||||
data=$(echo "$1"| tr -cd '0-9')
|
||||
|
||||
case $flag in
|
||||
m)
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ usage () {
|
|||
}
|
||||
|
||||
[ $# -ne 1 ] && usage
|
||||
ledstate=$(echo $1 | tr '[A-Z]' '[a-z]')
|
||||
ledstate=$(echo $1 | tr 'A-Z' 'a-z')
|
||||
|
||||
case $ledstate in
|
||||
normal|test|allon|alloff|production)
|
||||
ubus call leds set "{\"state\" : \"$ledstate\"}"
|
||||
ubus call leds set "{\"state\" : \"$ledstate\"}"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue