Operating System - HP-UX
1754294 Members
3000 Online
108813 Solutions
New Discussion юеВ

Truly read-only viewer like more or vi?

 
SOLVED
Go to solution
A. Daniel King_1
Super Advisor

Truly read-only viewer like more or vi?

Hi, folks -

Do any of you know of a read-only editor like vi/less/more/rvim/rvi? I guess I don't want an editor at all, but a secure ascii file viewer - without shell escapes or command execution - that otherwise acts like vi. I've been over a few items, but I've found problems with each:

> rview allows saves with a !, i.e., "wq!"
> more allows calling vi (or other editor) with 'v'.
> less ditto.
> Various options on vim including -Z -R, etc. still allow saving files with "wq!"
> pg -r behaves differently than vi (learning curve for my users).

Any ideas are greatly appreciated. HP-UX-only ideas supremely appreciated.
Command-Line Junkie
27 REPLIES 27
MANOJ SRIVASTAVA
Honored Contributor

Re: Truly read-only viewer like more or vi?

Hi Daniel


Did you try view , man view .


Manoj Srivastava
A. Daniel King_1
Super Advisor

Re: Truly read-only viewer like more or vi?

view allows "wq!" - and shell escapes.

As part of the charityware package vim, there are rvim and rview, which cut off the shell escapes:

:shell
:!ksh

However, I can still do:

:w!

And overwrite files.
Command-Line Junkie
Paula J Frazer-Campbell
Honored Contributor

Re: Truly read-only viewer like more or vi?

Hi

What about cat | more ??


Paula
If you can spell SysAdmin then you is one - anon
S.K. Chan
Honored Contributor

Re: Truly read-only viewer like more or vi?

Take a look at "mas" from the HPUX porting center. I remembered using it at one point in time. It's relatively simple and the way to run it is just "./mas filename". It brings up X and you have capbility to search within the viewer. I think it does not allow you to modify and save the file (so strictly viewing).

http://hpux.cs.utah.edu/hppd/hpux/Editors/mas-1.0/
Jeff Schussele
Honored Contributor

Re: Truly read-only viewer like more or vi?

Or just
more /path/to/filename
all by itself.
You can search w/more - just use the "/" as you would in vi as well as go to line numbers using "G".

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Daniel King_1
Super Advisor

Re: Truly read-only viewer like more or vi?

more in the case of 'cat x | more' does prevent file overwriting. This is good.

However, I can still do:

!ksh

I will look at mas. Does it look like vi?
Command-Line Junkie
A. Daniel King_1
Super Advisor

Re: Truly read-only viewer like more or vi?

more in the case of 'more x' ...

Try pressing the 'v' key while viewing a file with more. This throws you into your editor - vi typically. This is not the desired behavior.
Command-Line Junkie
A. Daniel King_1
Super Advisor

Re: Truly read-only viewer like more or vi?

mas is for GUIs. I neglected to mention that the system I'm on is almost completely terminal based.
Command-Line Junkie
S.K. Chan
Honored Contributor

Re: Truly read-only viewer like more or vi?

Looks like a regular hpterm/xterm window and all it has for it's menu bar (on top) are ..
- find (to find a certain text match)
- find same (not sure what's this)
- copy (presumbly allows you to copy text from this viewer to another window or editor)
- quit
- about
There is no other options for save/edit/cut/paste. It allows you to scroll the window text.