从 tty1 终端编辑文件

2 command-line tty sane

我想设置RUNyes/etc/default/saned,在提到这个答案

这是文件的片段:

# Defaults for the saned initscript, from sane-utils

# Set to yes to start saned
RUN=no

# Set to the user saned should run as
RUN_AS_USER=saned
Run Code Online (Sandbox Code Playgroud)

如何从 tty1 终端内编辑 saned 文件?

hee*_*ayl 5

打开TTY1(Ctl+ Alt+ F1 )和运行这个sed命令:

sed -i '/^RUN=no$/s/no$/yes/' /etc/default/saned
Run Code Online (Sandbox Code Playgroud)
  • /^RUN=no$/ 将匹配该行 RUN=no

  • 该行我们正在取代noyess/no$/yes/

  • -i 选项是就地编辑文件。

测试 :

    $ sed '/^RUN=no$/s/no$/yes/' /etc/default/saned

    # Defaults for the saned initscript, from sane-utils

    # Set to yes to start saned
    RUN=yes

    # Set to the user saned should run as
    RUN_AS_USER=saned
Run Code Online (Sandbox Code Playgroud)