EXOS 'cat' utility

  • 0
  • 3
  • Article
  • Updated 6 months ago
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"
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"
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;
}}
Photo of Dave Hammers

Dave Hammers, Dir SW Engineering

  • 3,722 Points 3k badge 2x thumb

Posted 6 months ago

  • 0
  • 3
Photo of Ludovico Stevens

Ludovico Stevens, Employee

  • 430 Points 250 badge 2x thumb
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'
Photo of Drew C.

Drew C., Community Manager

  • 40,238 Points 20k badge 2x thumb
Since vi is already available, a simpler line is:  alias edit "vi"
Photo of Dave Hammers

Dave Hammers, Dir SW Engineering

  • 3,722 Points 3k badge 2x thumb
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.
vs.
edit abc.x
with Ludovico's alias
Photo of Brandon Clay

Brandon Clay, Escalation Support Engineer

  • 13,486 Points 10k badge 2x thumb
Either of these aliases might cause some weirdness with the 'edit policy <pol_name>' command. That said, you can just do 'vi <pol_name>' or (with the alias) 'edit <pol_name>' instead.
Photo of Ludovico Stevens

Ludovico Stevens, Employee

  • 430 Points 250 badge 2x thumb
Did not realize that vi was already there...
But yes, my alias works:

EXOS-VM.37 #% cat test.cfg
this is my test

EXOS-VM.38 #% edit test.cfg
this is my test

~

...whereas vi directly does not:

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

Ciao
Ludovico