Создать несколько нетегированных виртуальных интерфейсов на одном физическом интерфейсе.

В man bashя нашел переменную окружения HISTIGNORE, описание которой выглядит следующим образом:

HISTIGNORE

        A  colon-separated list  of patterns  used to  decide which  command
        lines should be saved on the  history list. Each pattern is anchored
        at the  beginning of the line  and must match the  complete line (no
        implicit `*' is  appended). Each pattern is tested  against the line
        after the checks  specified by HISTCONTROL are  applied. In addition
        to the  normal shell  pattern matching  characters, `&'  matches the
        previous history  line. `&'  may be escaped  using a  backslash; the
        backslash  is removed  before  attempting a  match.  The second  and
        subsequent lines  of a multi-line  compound command are  not tested,
        and are added to the history regardless of the value of HISTIGNORE.

Итак, я экспортировал следующее значение в~/.bashrc:

bind '"\C-xr":   ". ~/.bashrc \C-x\C-z1\C-m"'
bind '"\C-x\C-z1":  re-read-init-file'

export HISTIGNORE="clear:history:. ~/.bashrc "

Последняя строка должна запрещать bashсохранять любую команду clear, historyи, что более важно, . ~/.bashrc.


Для zshя нашел вариант HIST_IGNORE_SPACE, который описан вman zshoptions:

HIST_IGNORE_SPACE (-g)

        Remove command lines  from the history list when the  first character on
        the line  is a  space, or when  one of the  expanded aliases  contains a
        leading space. Only  normal aliases (not global or  suffix aliases) have
        this behaviour.  Note that the  command lingers in the  internal history
        until the  next command is entered  before it vanishes, allowing  you to
        briefly reuse or edit the line. If you want to make it vanish right away
        without entering another command, type a space and press return.

Согласно тому, что там написано, если эта опция включена, zshдолжен удалить из истории все команды, начинающиеся с пробела. Однако он временно остается во внутренней истории, пока не будет выполнена следующая команда. Итак, я установил эту опцию в ~/.zshrc, а затем переопределил привязку клавиш к -источнику конфигурации оболочки следующим образом:

    setopt HIST_IGNORE_SPACE
    bindkey -s '^Xr' '. ~/.zshrc^M ^M'
#                     │            │
#                     │            └─ command containing only a space to force `zsh`
#                     │               to “forget“ the previous command immediately
#                     └─ space added to prevent `zsh` from logging the command
0
17.08.2019, 16:40
1 ответ

Благодаря LL3 я узнал, что эта функция называется macvlan, для ознакомления я помещу команду здесь:

ip link add link eth0 address 00:cc:cc:cc:11:33 eth0mac2 type macvlan
ip link set eth0mac2 up

Источник:https://serverfault.com/questions/576337/macvlan-interface-and-ppp-session

Это можно использовать для создания виртуального интерфейса L2 для PPPoE

1
28.01.2020, 02:39

Теги

Похожие вопросы