ExtremeSwitching (EXOS)

Expand all | Collapse all

EXOS 'cat' utility

  • 1.  EXOS 'cat' utility

    Posted 04-10-2018 10:07
    To create a linux like 'cat' utility in EXOS 22.4 and later:

    in the exshrc.xsf file add the following line (or create the exshrc.xsf file)

    alias cat "run script shell.py cd /usr/local/cfg;cat"[/code]Then the next time you login, the 'cat' alias will be available.

    E.g.
    # cat exshrc.xsf
    alias cat "run script shell.py cd /usr/local/cfg;cat"[/code]E.g.
    Suppose there is a file my.pol.
    # cat my.pol
    entry one {
    if {
    source-address 1.1.1.1/32;
    } then {
    meter joe1;
    }}
    entry two {
    if {
    source-address 1.1.1.2/32;
    } then {
    meter joe1;
    }}[/code]


  • 2.  RE: EXOS 'cat' utility

    Posted 04-10-2018 10:17
    Nice!
    Now we need an text edit (vi) command...
    ...and this seems to do it:
    alias edit='run script shell.py cd /usr/local/cfg;vi'[/code]


  • 3.  RE: EXOS 'cat' utility

    Posted 04-10-2018 10:17
    Since
    code:
    vi
    is already available, a simpler line is:
    code:
    alias edit "vi"



  • 4.  RE: EXOS 'cat' utility

    Posted 04-10-2018 10:17
    running vi in this mode restricts the filenames to specific suffix types
    E.g.
    vi abc.x
    Error: Invalid XOS Cli file extension with vi.
    Extension .pkt, .pol, .py, .xml, or .xsf is required.[/code]vs.
    edit abc.x[/code]with Ludovico's alias


  • 5.  RE: EXOS 'cat' utility

    Posted 04-10-2018 10:17
    Either of these aliases might cause some weirdness with the 'edit policy ' command. That said, you can just do 'vi ' or (with the alias) 'edit ' instead.


  • 6.  RE: EXOS 'cat' utility

    Posted 04-10-2018 10:17
    Did not realize that vi was already there...
    But yes, my alias works:

    EXOS-VM.37 #% cat test.cfg[/code]this is my test[/code]
    EXOS-VM.38 #% edit test.cfg[/code]this is my test[/code]
    ~[/code]
    ...whereas vi directly does not:

    EXOS-VM.38 #% vi test.cfg[/code]Error: Invalid XOS Cli file extension with vi.[/code] Extension .pkt, .pol, .py, .xml, or .xsf is required.[/code]
    Ciao
    Ludovico