Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试执行以下操作。
foo="foo:foo1" cc= `$foo | cut -f2 -d:`
我明白为什么这不起作用,但我不知道这样做。
提前致谢。
试试这个:
foo="foo:foo1" cc=`echo $foo | cut -f2 -d:`
需要进行 2 处更改:
=
在 bourne,你可以使用 set。无需外部命令。
$ foo="foo:foo1" $ IFS=":" $ set -- $foo $ echo $2 foo1