【问题标题】:Using Sed to edit my make.conf file使用 Sed 编辑我的 make.conf 文件
【发布时间】:2016-02-19 06:08:54
【问题描述】:

好的,所以我不久前发布了此内容,但找不到太多帮助。但是我正在为我正在上课的虚拟盒子上为gentoo制作一个自动安装脚本。我的脚本可以正确分区、正确下载 tarball(& 解压),并且我也在正确地进行 CHROOTing。

无论如何,我正在尝试使用 sed 来更改我的 make.conf,如下所示:

sed -i 's/CFLAGS="-02 -pipe"/CFLAGS="-march=native -02 -pipe"/g' /mnt/gentoo/etc/portage/make.conf 

运行后,我有一个“cat /mnt/gentoo/etc/portage/make.conf”来查看文件是否有效。它没有。如果有帮助的话,sed 的版本是 4.2.1。不知道我做错了什么。

【问题讨论】:

  • make.conf 的相关部分是什么?
  • @choroba 你是什么意思?
  • 你能显示你想替换的 make.conf 中的确切行吗?
  • @choroba 这条线是:CFLAGS="-02 -pipe"
  • 发布[[ -w /mnt/gentoo/etc/portage/make.conf ]] && echo okay || echo "not okay"sed -n '/CFLAGS="-02 -pipe"/p' /mnt/gentoo/etc/portage/make.confsed --version | head -n 1的输出。

标签: bash sed


【解决方案1】:

-02(零二)将是一个奇怪的选择。大概是-O2(O 二)吧。

【讨论】:

    猜你喜欢
    • 2015-02-27
    • 2011-12-17
    • 2011-05-26
    • 2022-07-12
    • 2012-04-19
    • 1970-01-01
    • 1970-01-01
    • 2010-10-17
    • 2015-01-12
    相关资源
    最近更新 更多