AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-159897

Pierre-Antoine Guillaume's questions

Martin Hope
Pierre-Antoine Guillaume
Asked: 2018-03-10 02:24:37 +0800 CST

从列表中使用并为每个元素运行(唯一)命令的实用程序

  • 0

我试图制作一个实用程序来从标准输入中读取一个列表,然后给它一个命令。

我制作了这个脚本:(命名consume_list)

#!/bin/bash

set -euo pipefail

eval "hack() {  $@ ; }"

while read -r line
do
    hack "$line"
done < <(cat /dev/stdin)

所以我可以包装命令并简化脚本的阅读和制作。

一个糟糕的例子是在 list 上使用 bash 替换(对我来说,它比 sed、cut、tr 等更容易),如:

cat log.txt | grep 'error' | consume_list 'echo ${1:20:10}'

这将

是否有适当的工具来实现这一目标?

bash shell-script
  • 1 个回答
  • 110 Views
Martin Hope
Pierre-Antoine Guillaume
Asked: 2018-02-24 06:06:26 +0800 CST

Unix 的扩展正则表达式是否兼容?

  • 1

Unix 的工具正则表达式完全兼容吗?

例如,如果我grep -oE "\$text *\( *([^)]) *\)",如果我使用,我是否保证替换我得到的确切部分sed -E "s/\$text *\( *([^)]) *\)/replacement/g"?这扩展到所有正则表达式?

这些匹配(或不匹配)到什么程度?

在旁注中,我的 man sed 没有显示-E开关 - 但仍然有效,并告诉我正则表达式开关是-r. 是-E和-r 同一件事吗?

grep sed
  • 1 个回答
  • 1005 Views
Martin Hope
Pierre-Antoine Guillaume
Asked: 2018-01-17 03:36:43 +0800 CST

如何恢复(或重置)*.debian.org 的 GPG 密钥?

  • 3

所以我想我删除或损坏了我为 *.debian.org 拥有的 gpg 密钥,这使得apt-get update产量

Ign http://ftp.fr.debian.org jessie InRelease
Réception de : 1 http://security.debian.org jessie/updates InRelease [63,1 kB]
Réception de : 2 http://ftp.debian.org jessie-backports InRelease [166 kB]
Réception de : 3 http://ftp.fr.debian.org jessie Release.gpg [2 434 B]
Ign http://security.debian.org jessie/updates InRelease
Réception de : 4 http://ftp.fr.debian.org jessie-updates InRelease [145 kB]
Ign http://security.debian.org jessie/updates/main Sources/DiffIndex
Ign http://ftp.debian.org jessie-backports InRelease
Ign http://security.debian.org jessie/updates/main amd64 Packages/DiffIndex
Err http://ftp.fr.debian.org jessie-updates InRelease

Réception de : 5 http://ftp.debian.org jessie-backports/main amd64 Packages/DiffIndex [27,8 kB]
Atteint http://ftp.fr.debian.org jessie Release
Ign http://ftp.fr.debian.org jessie Release
Réception de : 6 http://ftp.debian.org jessie-backports/contrib amd64 Packages/DiffIndex [25,3 kB]
Ign http://ftp.fr.debian.org jessie/main Sources/DiffIndex
Ign http://ftp.fr.debian.org jessie/main amd64 Packages/DiffIndex
Atteint http://security.debian.org jessie/updates/main Translation-en
Atteint http://security.debian.org jessie/updates/main Sources
Atteint http://security.debian.org jessie/updates/main amd64 Packages
Atteint http://ftp.debian.org jessie-backports/contrib Translation-en
Atteint http://ftp.fr.debian.org jessie/main Translation-fr
Atteint http://ftp.fr.debian.org jessie/main Translation-en
Ign http://security.debian.org jessie/updates/main Translation-fr_FR
Ign http://security.debian.org jessie/updates/main Translation-fr
Atteint http://ftp.debian.org jessie-backports/main Translation-en
Atteint http://ftp.fr.debian.org jessie/main Sources
Atteint http://ftp.fr.debian.org jessie/main amd64 Packages
Ign http://ftp.fr.debian.org jessie/main Translation-fr_FR
Ign http://ftp.debian.org jessie-backports/contrib Translation-fr_FR
Ign http://ftp.debian.org jessie-backports/contrib Translation-fr
Ign http://ftp.debian.org jessie-backports/main Translation-fr_FR
Ign http://ftp.debian.org jessie-backports/main Translation-fr
430 ko réceptionnés en 2s (175 ko/s)
Lecture des listes de paquets…
W: Erreur de GPG : http://security.debian.org jessie/updates InRelease : Les signatures suivantes n'ont pas pu être vérifiées car la clé publique n'est pas disponible : NO_PUBKEY (SOME hexadecimals) NO_PUBKEY (SOME hexadecimals)
W: Erreur de GPG : http://ftp.debian.org jessie-backports InRelease : Les signatures suivantes n'ont pas pu être vérifiées car la clé publique n'est pas disponible : NO_PUBKEY (SOME hexadecimals) NO_PUBKEY (SOME hexadecimals)
W: Une erreur s'est produite lors du contrôle de la signature. Le dépôt n'est pas mis à jour et les fichiers d'index précédents seront utilisés. Erreur de GPG : http://ftp.fr.debian.org jessie-updates InRelease : Les signatures suivantes n'ont pas pu être vérifiées car la clé publique n'est pas disponible : NO_PUBKEY (SOME hexadecimals) NO_PUBKEY (SOME hexadecimals)

W: Erreur de GPG : http://ftp.fr.debian.org jessie Release : Les signatures suivantes n'ont pas pu être vérifiées car la clé publique n'est pas disponible : NO_PUBKEY (SOME hexadecimals) NO_PUBKEY (SOME hexadecimals) NO_PUBKEY (SOME hexadecimals)
W: Impossible de récupérer http://ftp.fr.debian.org/debian/dists/jessie-updates/InRelease  

W: Le téléchargement de quelques fichiers d'index a échoué, ils ont été ignorés, ou les anciens ont été utilisés à la place.

“Les signatures suivantes n'ont pas pu être vérifiées car la clé publique n'est pas disponible”大致翻译为“无法检查以下签名,因为公钥不可用”。

我怎样才能挽回这些错误?

更新:我做了

# wget http://ftp.fr.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2017.5~deb8u1_all.deb
# dpkg -i debian-archive-keyring_2017.5~deb8u1_all.deb

但什么都没有改变。我怀疑导致整个事情的原因是

# curl -s https://www.dotdeb.org/dotdeb.gpg | apt-key remove

删除几分钟前我刚刚添加的 gpg 密钥。

apt gpg
  • 2 个回答
  • 7050 Views
Martin Hope
Pierre-Antoine Guillaume
Asked: 2017-12-16 19:21:26 +0800 CST

如何为 bash 命令每行读取多个参数?

  • 1

我有一个格式为的文件(ordered_names)

pub 000.html
pub.19 001.html

大约 300 行,我找不到将其提供给 mv 命令的方法。

我已阅读将存储在文件中的字符串作为命令的参数列表提供?,但我无法得到我的目的。

以下是我所做的一些尝试:

for line in "$(cat ../ordered_files.reversed)"; do mv  $(echo "$line"); done
for line in "$(cat ../ordered_files.reversed)"; do echo mv $(echo $line | cut -d' ' -f 1) $(echo $line | cut -d' ' -f 2) ; done
mv for
  • 1 个回答
  • 1361 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve