Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如果只是为了一个_String_Bash_Split_Ifs - Fatal编程技术网

String 如果只是为了一个

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

嘿,伙计们,我想把一根线分成两段,例如分辨率=1024x786,宽度=1024,高度=786。 为此,我发现以下代码:

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坐标