小编Law*_*tre的帖子

在 xargs 中选择位置参数

我想打开安装python的位置。检查我使用的位置。

whereis python | xargs -n 1 echo
Run Code Online (Sandbox Code Playgroud)

输出 :


/usr/bin/python3.8

/usr/bin/python3.8-config

/usr/bin/python

/usr/lib/python2.7

/usr/lib/python3.8

/usr/lib/python3.9

/etc/python3.8

/usr/local/lib/python3.8

/usr/include/python3.8
Run Code Online (Sandbox Code Playgroud)

虽然我可以复制 xdg 的位置,但我不想这样做。我想使用管道运算符并使用xdg-open. 然而,有一个问题。如何从上面的列表中选择参数。假设我想选择第三个位置。有什么办法可以做到。

我想跟随,但没有奏效。

whereis python | xargs $3 xdg-open
Run Code Online (Sandbox Code Playgroud)

command-line bash

1
推荐指数
1
解决办法
244
查看次数

标签 统计

bash ×1

command-line ×1