I like to be able to do
export BROWSER="lynx -cfg=~/.lynx.cfg". I tried this directly, and I also tried setting an alias
alias lynx="lynx -cfg=~/.lynx.cfg", but these didn't work. (Meaning that tools that use this variable to launch a browser still ignored my config file or didn't launch the browser at all.)
I like to be able to do
$BROWSER is understood by several utilities as being your web browser of choice.
Depending on the utility, it will be expected to contain:
- the path or name of the executable
- a list of words the first of which is the path or name and the other ones a list of initial arguments. If you're lucky, it will also understand some form of quoting similar to what shells do.
- (very unlikely and it would be a very unwise thing to do) the start of a shell command line.
If you were in the first case, I'd expect the utility you tried it in to complain about an unexisting
"lynx -cfg=~/.lynx.cfg" command.
In the third case, note that shells don't expand the
zsh only does it when the
magicequalsubst option is enabled.
bash only expands a
~ after a
= if what's on the left of
= looks like a valid variable name and it's not in POSIX mode.
lynx (at least version 2.8.9dev.16 on my system) does appear to understand
~ as meaning one's home directory by itself, so I'd expect yours to work for utilities in the second and third category.
$ BROWSER='echo -cfg=~' sensible-browser foo -cfg=~ foo
So either your browser is of a fourth category that ignores anything but the first word or only takes a hint as to what your browser is; or your version of
lynx doesn't understand
~ as meaning home.
Run your utility as
strace -fe execve the-utility to see what it tries to execute.
In the case of your versions of
lynx not treating
~ as home, you can define
export BROWSER="lynx -cfg=$HOME/.lynx.cfg"
$HOME doesn't contain blanks or quotes (or other characters special to a shell))
In any case, you should be able to define
$BROWSER as a script that passes the correct parameters to
#! /bin/sh - exec lynx -cfg="$HOME/.lynx.cfg" "$@"
and use that as your
Incidentally, if your
$HOME started with
~ characters, that would fool
lynx, which is why it's not such a good idea for
lynx to handle those
~ by itself.
I don't think you can however you could try:
Must use absolute path.
Create new file lynx.sh in home dir.
#!/bin/bash linx -cfg=/home/username/.lynx.cfg
Make it exicutable.
Launching Browser should launch lynx. or ./lynx.sh
Use in next step.
Must use absolute path to: lynx.cfg
Must use absolute path to: lynx, if not in /usr/bin/
Must use ' ' if path contains special charactors.