Skip to content

Instantly share code, notes, and snippets.

@cn00
Last active February 3, 2023 02:00
Show Gist options
  • Save cn00/c77a16ffe824a63ed9a53dcc7c840f06 to your computer and use it in GitHub Desktop.
Save cn00/c77a16ffe824a63ed9a53dcc7c840f06 to your computer and use it in GitHub Desktop.
split string to vars
# IFS set
a='111|222|333'
OIFS=$IFS; IFS="|"; set -- $a; aa=$1;bb=$2;cc=$3; IFS=$OIFS
echo $aa $bb $cc
111 222 333
#eval
s='a=22;b=33;c=44;d=5'
eval $s
echo $a $c $b $d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment