Created
January 19, 2018 13:21
-
-
Save okraits/3e0a14827a619b4f85dcc27cb1df32b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
common_set_list_old() { | |
local cfg="$1" | |
local val="$2" | |
local element list=${val//,/ } | |
#$UCI_DELETE $cfg | |
for element in $list; do | |
echo "$element" | |
done | |
return 0 | |
} | |
common_set_list_new() { | |
local cfg="$1" | |
local val="$2" | |
#$UCI_DELETE $cfg | |
local oldIFS="$IFS" | |
IFS=',' | |
for element in $val; do | |
IFS="$oldIFS" | |
echo "$element" | |
done | |
return 0 | |
} | |
goodstring="foobar,barfoo" | |
badstring="foo bar,bar foo" | |
common_set_list_old "" "$goodstring" | |
common_set_list_old "" "$badstring" | |
common_set_list_new "" "$goodstring" | |
common_set_list_new "" "$badstring" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment