这个问题只发生在 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)
我不明白是什么sed8Ey5tD,ls看不到它。我认为是 docker 造成的,但无法弄清楚。
如何取得sed成功?
好的,我发现文件正在被 docker 卷, volumes: /xxx/config.json : /xxx/config/config.json 在docker-compose.yml. 之后docker-compose down,就可以编辑文件了。但是我如何在没有 的情况下编辑文件docker-compose down?
我想.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) ssh-copy-id root@c199成功过。ssh root@c199没有密码提示的情况下登录ufo (远程机器有这个用户)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)