lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] changing lynx default homepage from the comand line?


From: Tim Chase
Subject: Re: [Lynx-dev] changing lynx default homepage from the comand line?
Date: Sun, 17 Nov 2019 15:28:06 -0600

The big picture goal is to create a local/user-specific lynx.cfg file
in your home directory.  This can be as minimal as that one
"STARTFILE" line produced by the `echo` command, and then start lynx
using that config file.

You can use a text-editor to create/edit the ~/.lynx.cfg file and
append the line

  STARTFILE:https://ca.yahoo.com/news

at the bottom.  Alternatively you can use "echo" to append the file
(creating it if it doesn't already exist):

  $ echo "STARTFILE:https://ca.yahoo.com/news"; >> ~/.lynx.cfg

With that local/user-specific config file available, you can then
start lynx manually using that config file:

  $ lynx -cfg=$HOME/.lynx.cfg

but typing that whole thing every time gets tedious.  So to avoid
that tedium, you want to let your shell know that when you type
"lynx" (or "ly" or whatever short-hand you want) that you really mean
"every time I type `lynx`, pretend that I added -cfg=$HOME/.lynx.cfg
after it".  You can do this with an alias or with a function though
the function is a bit more flexible. This would be created in one of
your shell startup files. However the exact syntax and file-names for
that startup file depend on the shell you're using. That's why I'm
interested in the output of

  $ basename $SHELL

to make sure which shell you're running.  In all liklihood, it's
"bash" in which case it would also help for you to provide the output
of

  $ ls ~/.bash*

If that output includes a .bash_aliases file, that's the best place
to put an alias/function.  Otherwise, you can just append it to your
.bashrc (which would most likely be among the output).

However your shell could also be any of a number of common
alternatives like sh, ash, dash, zsh, ksh, csh, tcsh, fish, or yet
others.  Each one has its own configuration files and making sure
that the edit takes place in the right one is essential to ensuring
that the alias/function gets created properly.

But then once you have the alias/function in your local start-up
file, every time you type "lynx" (or "ly" or whatever short-hand you
prefer), it will start with your preferred configuration.

-tim


On 2019-11-17 14:10, Karen Lewellen wrote:
> Tim,
> *should* is an interesting concept.  What should  be does not
> always translate into what is.
> For example,
> Your echo line below is a fantastic example of the kind of command
> line idea I have been seeking the entire time.
> However, because there are   about ten different  lynx.cfg files in
> the home directory of my site hosted here on shellworld, running it
> did not produce any changes.
> I got no errors, meaning  likely something was changed, just not
> the lynx.cfg file governing  my karenlewellen.com workspace hosted
> at shellworld.
> still, it was at least the sort of  solution I desired, a simple
> command line  that could be run without editing altering or
> changing anything else.
> As I said to rick,  that he has done something himself in no way 
> translates to  the approximately 7 billion others sharing our world.
> Karen
> 
> 
> On Sun, 17 Nov 2019, Tim Chase wrote:
> 
> > There are system-level config files which you should be able to
> > read but not modify.  There are also user-level config files
> > which you are expected to be able to read and modify to make your
> > life easier.
> >
> > Yes, you can manually specify a config file every time on the
> > command line, or specify the start-URL on the command-line every
> > time, or establish environment variables every time you log in,
> > or define a function/alias everytime you log in.
> >
> > But the purpose of creating local/user-level config files is for
> > your own conveneince.  So that when you type "lynx" (or "ly" or
> > whatever short-hand abbreviation you want), it does exactly what
> > *you* want (within the software's limitations) every time.
> >
> > As David mentions, if your Shellworld account allows you to modify
> > system-level config files, that would impact everybody on the
> > system and be a big security issue.  But I suspect that the
> > administrator left permissions as their defaults and so you can't
> > change the site-wide settings as a mere user.  But you can copy
> > the lynx.cfg file -- either from your system /etc/lynx.cfg or
> > /usr/local/etc/lynx.cfg or downloading a copy from the internet
> > -- to your home directory, modify it to your satisfaction, and
> > then instruct lynx to use that config file instead.  For your
> > purposes, you might even be able to just use "echo" to put the
> > one line in a file without any text editor:
> >
> >  $ echo 'STARTFILE:https://example.com' >> ~/.lynx.cfg
> >
> > if you want to start at example.com
> >
> > You then modify your *local* (not system-wide) shell configuration
> > file to create the command you use to override that config file:
> >
> >  $ echo 'lynx() { command lynx -cfg ~/.lynx.cfg "$@" ; }' >>
> > ~/.bashrc
> >
> > or whatever your local shell-configuration file is depending on
> > your shell. Again, would be helpful to know the output of
> >
> >  $ basename $SHELL
> >
> > to know which shell you're in.
> >
> > Once you've configured these two things, invoking lynx should give
> > you the settings you want every time without needing to re-type
> > them.
> >
> > The local/user-level configuration files are there specifically to
> > make each user's life easier, without impacting other users on the
> > same system.
> >
> > I'm still hoping I could get a Shellworld account so I can test
> > some of these things to give you a more targeted reply, but I've
> > not heard back from the admin on any of the occasions I've tried
> > emailing them.
> >
> > -tim
> >
> > On 2019-11-16 22:39, Karen Lewellen wrote:  
> >> because this is not my service I wish to tamper with config files
> >> as little  as possible.
> >> If there is not a command line only method to accomplish this
> >> task, much like  the -useragent one, then never mind.
> >> thanks for all the ideas but  again  I am not interested in
> >> altering lynx.cfg in any fashion.
> >> Karen
> >>
> >>
> >> On Fri, 15 Nov 2019, Tim Chase wrote:
> >>  
> >>> Karen,
> >>>
> >>> You can combine Thorsten's advice to use "-cfg=FILENAME" with my
> >>> previous shell-alias suggestion, which is what I've done in the
> >>> past to specify a local config file.  With that in place, you
> >>> can set your default home-page in your local lynx config file
> >>> (say, ~/.lynx.cfg)
> >>>
> >>>  echo "STARTFILE:https://example.com"; >> ~/.lynx.cfg
> >>>
> >>> and then have your function/alias specify the config file:
> >>>
> >>>  lynx() { command lynx -cfg=$HOME/.lynx.cfg "$@" ; }
> >>>
> >>> I happen to like the TEXTFIELDS_NEED_ACTIVATION:TRUE set in my
> >>> .cfg file too, so this is how I get that behavior every time.
> >>>
> >>> -tim
> >>>
> >>>
> >>> On 2019-11-15 22:56, Thorsten Glaser wrote:  
> >>>> Karen Lewellen dixit:
> >>>>  
> >>>>> I am seeking a command line method  to override the site
> >>>>> listed as the homepage for lynx regularly,  i. e. the page
> >>>>> that appears if i just entre lynx.  
> >>>>
> >>>> Then don’t enter just lynx ;-)
> >>>>
> >>>> Otherwise, you can override the homepage in the lynx.cfg file.
> >>>> Since you’re on a shellserver you cannot do that system-wide,
> >>>> but you can copy the system-wide one into your home directory
> >>>> and use the -cfg=FILENAME option to point to the changed file.
> >>>>  
> >>>>> The idea is  to change this  default homepage, not just simply
> >>>>> visit a new site once.  
> >>>>
> >>>> But the “homepage” is only shown if you don’t tell it a site
> >>>> to visit when starting.
> >>>>
> >>>> It’s probably easiest to make an alias, something like this:
> >>>>
> >>>> echo "alias 'ly=lynx http://the.new.start.site'" >>~/.bashrc
> >>>>
> >>>> Then typing ly will start lynx with the other start page.
> >>>> Easier than doing the config dance, unless you need that
> >>>> anyway.
> >>>>
> >>>> bye,
> >>>> //mirabilos
> >>>> --
> >>>> FWIW, I'm quite impressed with mksh interactively. I thought it
> >>>> was much *much* more bare bones. But it turns out it beats the
> >>>> living hell out of ksh93 in that respect. I'd even consider it
> >>>> for my daily use if I hadn't wasted half my life on my zsh
> >>>> setup. :-) -- Frank Terbeck in #!/bin/mksh
> >>>>
> >>>> _______________________________________________
> >>>> Lynx-dev mailing list
> >>>> address@hidden
> >>>> https://lists.nongnu.org/mailman/listinfo/lynx-dev  
> >>>
> >>>
> >>>  
> >
> >
> >  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]