小编Mit*_*ril的帖子

在 docker 中查找和 sed 字符串出现错误“设备或资源繁忙”

这个问题只发生在 docker 容器中。

只有find

find ${BASIN_SPIDER_CONFIG_PATH} -type f -name "*.json"
Run Code Online (Sandbox Code Playgroud)

find 与 sed

find ${BASIN_SPIDER_CONFIG_PATH} -type f -name "*.json"|xargs sed -i "s/10.142.55.199/host02/g"
Run Code Online (Sandbox Code Playgroud)

给出一个错误:

/xxx/config/sed8Ey5tD: Device or resource busy
Run Code Online (Sandbox Code Playgroud)

我不明白是什么sed8Ey5tDls看不到它。我认为是 docker 造成的,但无法弄清楚。

如何取得sed成功?


好的,我发现文件正在被 docker 卷, volumes: /xxx/config.json : /xxx/config/config.jsondocker-compose.yml. 之后docker-compose down,就可以编辑文件了。但是我如何在没有 的情况下编辑文件docker-compose down

sed find xargs docker

11
推荐指数
2
解决办法
1万
查看次数

在目录下查找完整路径和文件名,然后将其作为参数传递给可执行文件

我想.txt在一个目录下找到所有的完整路径和文件名,并传递给一个可执行文件./thulac

我花了一些时间才到达:

find /mnt/test -name "*.txt" -print0 |xargs -l bash -c './thulac < $0' 
Run Code Online (Sandbox Code Playgroud)

但这只能找到完整路径。

带有多个参数的 xargs 中 ,我看到:

echo argument1 argument2 argument3 | \
   xargs -l bash -c 'echo this is first:$0 second:$1 third:$2' | xargs
Run Code Online (Sandbox Code Playgroud)

我想要实现的是这样的:

find /mnt/test -name "*.txt" -print0 -printf "%f" | \
   xargs -0 bash -c './thulac < $0 > $1' 
Run Code Online (Sandbox Code Playgroud)

虽然在这里,当有多个文件时xargs无法正确拆分-print0 -printf "%f"为两个参数,这让我感到困惑。


例子:

find /mnt/test -name "*.txt" -print0 -printf "%f" | \
   xargs -0 …
Run Code Online (Sandbox Code Playgroud)

linux command-line shell find xargs

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

ssh-copy-id 成功了,但是还是提示输入密码

  1. 我以前ssh-copy-id root@c199成功过。
  2. 我可以在ssh root@c199没有密码提示的情况下登录
  3. 我想由另一个用户自动登录ufo (远程机器有这个用户)
  4. ssh-copy-id ufo@c199 要求我输入密码,

    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
    ufo@c199's password:
    
    Number of key(s) added: 1
    
    Now try logging into the machine, with:   "ssh 'ufo@c199'"
    and check to make sure that only the key(s) you wanted …
    Run Code Online (Sandbox Code Playgroud)

password ssh authentication sshd

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

find ×2

xargs ×2

authentication ×1

command-line ×1

docker ×1

linux ×1

password ×1

sed ×1

shell ×1

ssh ×1

sshd ×1