String 如果只是为了一个
嘿,伙计们,我想把一根线分成两段,例如分辨率=1024x786,宽度=1024,高度=786。 为此,我发现以下代码:String 如果只是为了一个,string,bash,split,ifs,String,Bash,Split,Ifs,嘿,伙计们,我想把一根线分成两段,例如分辨率=1024x786,宽度=1024,高度=786。 为此,我发现以下代码: set -- "$resolution" IFS="x"; declare -a coordinates=($*) 但是现在我所有的变量,在任何位置都包含一个“x”,在这里分裂。如何仅为我的$resolution使用此“if” 感谢您的帮助:)一个解决方案 IFS=x read -r -a coordinates <<<"$resolution" IFS
set -- "$resolution"
IFS="x"; declare -a coordinates=($*)
但是现在我所有的变量,在任何位置都包含一个“x”,在这里分裂。如何仅为我的$resolution使用此“if”
感谢您的帮助:)一个解决方案
IFS=x read -r -a coordinates <<<"$resolution"
IFS=x读取-r-a坐标一个解决方案
IFS=x read -r -a coordinates <<<"$resolution"
IFS=x读取-r-a坐标