Last active
February 3, 2023 02:00
-
-
Save cn00/c77a16ffe824a63ed9a53dcc7c840f06 to your computer and use it in GitHub Desktop.
split string to vars
This file contains hidden or 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
| # 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