Discussion:
BASH reference for those who are "learning by doing"?
(too old to reply)
Richard Owlett
2024-09-07 16:00:01 UTC
Permalink
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.

But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.

I've downloaded "Bash Reference Manual"
[https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
for when I need fine grained details.
I've bookmarked the various links on
[https://mywiki.wooledge.org/BashFAQ]
for quick reference.

I find neither to be search friendly.

Suggestions?

TIA
David Christensen
2024-09-07 18:00:01 UTC
Permalink
Post by Richard Owlett
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
I've downloaded "Bash Reference Manual"
  [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
for when I need fine grained details.
I've bookmarked the various links on
  [https://mywiki.wooledge.org/BashFAQ]
for quick reference.
I find neither to be search friendly.
Suggestions?
TIA
I suggest "Mastering Regular Expressions" by Friedl:

https://www.amazon.com/dp/0596528124


David
d***@howorth.org.uk
2024-09-07 19:20:02 UTC
Permalink
Post by Richard Owlett
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
I've downloaded "Bash Reference Manual"
[https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
for when I need fine grained details.
I've bookmarked the various links on
[https://mywiki.wooledge.org/BashFAQ]
for quick reference.
I find neither to be search friendly.
Suggestions?
Typing "regular expression tutorial" or "regular expression bash" into
a search engine produces lots of potentially useful links.

Maybe https://en.wikibooks.org/wiki/Regular_Expressions
Post by Richard Owlett
TIA
Quaeryth
2024-09-07 20:50:02 UTC
Permalink
Post by Richard Owlett
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
I've downloaded "Bash Reference Manual"
[https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
for when I need fine grained details.
I've bookmarked the various links on
[https://mywiki.wooledge.org/BashFAQ]
for quick reference.
I find neither to be search friendly.
Suggestions?
TIA
When I've been in the same position, I don't know that I have a single
go-to resource. Instead I tend to search for what I'm wanting to do at
the moment and then check out results that seem relevant from
https://stackoverflow.com/. I usually have pretty good luck there.
https://devhints.io/bash may be helpful, and a couple of the other pages
linked at the top looked pretty good, too (e.g. the wiki you referenced).

Unsolicited thoughts: When it comes to regexes (regular expressions),
the syntax can depend on where/in what (programming) language or
application you're using it. When I was trying to sort it all out I
stumbled upon https://www.regular-expressions.info/, which was a big
help to me. If you click on "Tools & Languages" at the top of the page,
you can also get explanations for how regexes are implemented in your
particular context. I used this site as a reference while trying to pull
data out of log files at work in a text editor (Sublime Text, which I
highly recommend for immediate feedback on your regex attempts). If you
don't have a big file to practice with, try saving one of the links on
https://openbible.com/texts.htm for a copy of the Christian Bible in a
single text file. I'm sure there's other text files like that out there
if that's not your cup of tea. Good luck with regex; each time I need it
is a fun and useful puzzle to solve.

Quaeryth
Richard Owlett
2024-09-07 21:30:01 UTC
Permalink
Post by Quaeryth
Post by Richard Owlett
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
I've downloaded "Bash Reference Manual"
[https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
for when I need fine grained details.
I've bookmarked the various links on
[https://mywiki.wooledge.org/BashFAQ]
for quick reference.
I find neither to be search friendly.
Suggestions?
TIA
When I've been in the same position, I don't know that I have a single
go-to resource. Instead I tend to search for what I'm wanting to do at
the moment and then check out results that seem relevant from
https://stackoverflow.com/. I usually have pretty good luck there.
https://devhints.io/bash may be helpful, and a couple of the other pages
linked at the top looked pretty good, too (e.g. the wiki you referenced).
Problem is they are pedagogy oriented so to speak. I'm looking for
easier searchability (real word? ;).
Post by Quaeryth
Unsolicited thoughts: When it comes to regexes (regular expressions),
the syntax can depend on where/in what (programming) language or
application you're using it. When I was trying to sort it all out I
stumbled upon https://www.regular-expressions.info/, which was a big
help to me. If you click on "Tools & Languages" at the top of the page,
you can also get explanations for how regexes are implemented in your
particular context. I used this site as a reference while trying to pull
data out of log files at work in a text editor (Sublime Text, which I
highly recommend for immediate feedback on your regex attempts). If you
don't have a big file to practice with, try saving one of the links on
https://openbible.com/texts.htm for a copy of the Christian Bible in a
single text file. I'm sure there's other text files like that out there
if that's not your cup of tea. Good luck with regex; each time I need it
is a fun and useful puzzle to solve.
I've got helpful references for regular expressions. Their examples use
Bash as the vehicle. I want to get my real world examples into Bash so I
can follow the example techniques given.

[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by fellow
tri-focal wearing senior citizens - that I want to minimize the number
of HTML tags & eliminating all CSS usage annoys some HTML5 purists ;]
Post by Quaeryth
Quaeryth
Quaeryth
2024-09-07 22:10:01 UTC
Permalink
Post by Richard Owlett
When I've been in the same position, [...] too (e.g. the wiki you referenced).
Problem is they are pedagogy oriented so to speak. I'm looking for
easier searchability (real word? ;).
Unsolicited thoughts: When it comes to regexes (regular expressions) [...] useful puzzle to solve.
I've got helpful references for regular expressions. Their examples use
Bash as the vehicle. I want to get my real world examples into Bash so I
can follow the example techniques given.
[My examples are from my experiments with re-formatting
text at
https://ebible.org/engkjvcpb/
for comfortable reading by fellow
tri-focal wearing senior citizens - that I want to minimize the number
of HTML tags & eliminating all CSS usage annoys some HTML5 purists ;]
Got it. I would rely on a search engine to do the heavy lifting for me and then use something like the Bash Reference Manual for more details, in that case, since I don't know of an individual resource that would do what you need. A query like "site:stackoverflow.com bash how to read file into variable" via Google or DuckDuckGo (and maybe other search engines) usually points me in the right direction. Good luck with your experiments!

Q
Greg Wooledge
2024-09-08 00:00:03 UTC
Permalink
Post by Quaeryth
A query like "site:stackoverflow.com bash how to read file into variable" via
Google or DuckDuckGo (and maybe other search engines) usually points me in
the right direction. Good luck with your experiments!
What kind of file?
What kind of variable?
What are you planning to do with the variable after you've stored data
in it?

The fundamental problem with this question is that bash variables *can't*
store all kinds of data. Specifically, they are unable to store the NUL
byte (ASCII 0x00), so storing any kind of binary file is off the table.

So, that leaves text files. You can, in theory, store a text file in
a bash variable -- but why? What's the point? Are you going to copy
that data out to another file? If so, you'd be better off just copying
the original text file with the cp command, instead of reading the data
into a shell string variable and then writing it back out. Bash is
abysmally *slow* at such things. Running cp would most likely be faster,
for non-tiny files, even if you have to run it several times.

But maybe this is an X-Y problem, and the real question is something
like "I want to iterate over the lines of a file. For each line, I
want to do ____."

In that case, reading the entire file into a string variable is a poor
first step. Now, you *might* read the entire file into an *array*
variable (one line per array element), and then iterate over the array.
That's not the worst thing you could do.

But even that may not be necessary. If you don't need to pre-read the
entire contents, then don't. Just read one line at a time, and process
each line as you read it.

That's Bash FAQ #1. <https://mywiki.wooledge.org/BashFAQ/001>
Richard Owlett
2024-09-08 11:50:01 UTC
Permalink
Post by Greg Wooledge
Post by Quaeryth
A query like "site:stackoverflow.com bash how to read file into variable" via
Google or DuckDuckGo (and maybe other search engines) usually points me in
the right direction. Good luck with your experiments!
What kind of file?
What kind of variable?
What are you planning to do with the variable after you've stored data
in it?
[snip]
This started with exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have. >
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
I have 2 relevant test cases:
1. a file of a single line approximately 200 characters.
[teststring1.txt]
2. a file with ~20 lines whose size is 4.5k.
[teststring1.txt]

How?
Max Nikulin
2024-09-08 03:40:01 UTC
Permalink
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by fellow
tri-focal wearing senior citizens - that I want to minimize the number
of HTML tags & eliminating all CSS usage annoys some HTML5 purists ;]
Instead of BASH and regular expression use some programming language
where a reliable HTML parser is available. E.g. in python you may use
lxml.html.html5parser, lxml.etree.HTMLParser, BeautifulSoup.

Calibre aggressively strips CSS and some markup during conversion of
HTML pages to various ebook formats.
Richard Owlett
2024-09-08 11:50:01 UTC
Permalink
Post by Max Nikulin
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by
fellow tri-focal wearing senior citizens - that I want to minimize the
number of HTML tags & eliminating all CSS usage annoys some HTML5
purists ;]
Instead of BASH and regular expression use some programming language
where a reliable HTML parser is available. E.g. in python you may use
lxml.html.html5parser, lxml.etree.HTMLParser, BeautifulSoup.
Calibre aggressively strips CSS and some markup during conversion of
HTML pages to various ebook formats.
This started with exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
d***@howorth.org.uk
2024-09-08 15:30:01 UTC
Permalink
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by
fellow tri-focal wearing senior citizens
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.

I did this years ago and wouldn't try to do it any other way now. The
bliss of being able to read the whole screen comfortably without moving
if I want to.
Steve McIntyre
2024-09-08 16:20:01 UTC
Permalink
Post by d***@howorth.org.uk
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by
fellow tri-focal wearing senior citizens
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I did this years ago and wouldn't try to do it any other way now. The
bliss of being able to read the whole screen comfortably without moving
if I want to.
100% agreed. When I started with varifocals 3 years ago, my optician
strongly recommended also getting a set of fixed-focus glasses for
monitor work. Despite the inconvenience of carrying multiple pairs of
glasses, I totally understand why - it makes a huge difference when
I'm sat in front of the screen for hours at a time.
--
Steve McIntyre, Cambridge, UK. ***@einval.com
Can't keep my eyes from the circling sky,
Tongue-tied & twisted, Just an earth-bound misfit, I...
e***@gmx.us
2024-09-08 17:10:01 UTC
Permalink
Post by Steve McIntyre
Post by d***@howorth.org.uk
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by
fellow tri-focal wearing senior citizens
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I did this years ago and wouldn't try to do it any other way now. The
bliss of being able to read the whole screen comfortably without moving
if I want to.
100% agreed. When I started with varifocals 3 years ago, my optician
strongly recommended also getting a set of fixed-focus glasses for
monitor work. Despite the inconvenience of carrying multiple pairs of
glasses, I totally understand why - it makes a huge difference when
I'm sat in front of the screen for hours at a time.
That's what my dad did. I thought he was just being weird, but now that I
have a touch of presbyopia, it all becomes clear.

I have searched in vain for reading glasses that fit over a regular pair of
prescription glasses. Yeah the combination is heavy and you're looking
through two more surfaces, but you only have to buy them once and annoyance
is a lot more plentiful than cash.

--
When we've nuked the world to a cinder, the cockroaches picking
over the remains will be crawling over the remaining artifacts
and wondering what "PC LOAD LETTER" means. -- PC / ASR
Richard Owlett
2024-09-09 12:00:01 UTC
Permalink
Post by Steve McIntyre
Post by d***@howorth.org.uk
Post by Richard Owlett
[My examples are from my experiments with re-formatting
text at https://ebible.org/engkjvcpb/ for comfortable reading by
fellow tri-focal wearing senior citizens
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I did this years ago and wouldn't try to do it any other way now. The
bliss of being able to read the whole screen comfortably without moving
if I want to.
100% agreed. When I started with varifocals 3 years ago, my optician
strongly recommended also getting a set of fixed-focus glasses for
monitor work. Despite the inconvenience of carrying multiple pairs of
glasses, I totally understand why - it makes a huge difference when
I'm sat in front of the screen for hours at a time.
I concur. My computer glasses have removed a lot of monitor fatigue.
I'm very nearsighted with a significant astigmatism correction.
For general use I wear my tri-focals.
For computer/desk use I have a pair of bi-focals as the correction
needed for looking at screen is enough different than that for looking
at notes on my desktop [or keyboard ;].
ael
2024-09-08 16:40:01 UTC
Permalink
On Sun, 8 Sep 2024 16:25:04 +0100
Tell them to get a [very cheap] pair of single focus reading glasses
made to suit the distance their screen is away.
Works fine if there is not too much astigmation and both eyes need
roughly the same correction. Then a £1.50 pair from a local discount
shop will be fine. Otherwise it will cost a bit more....
Yassine Chaouche
2024-09-08 17:40:01 UTC
Permalink
Missed (deleted) the start of the discussion.

Not sure if it helps but:
I juste made public my toolbox.txt file: https://ychaouche.github.io/toolbox.txt
it is meant to be open in emacs,
so that you can use its outliner mode and read only what you're interested in.

The relevant part is in "** command line tricks" (Loading Image...)

You can also take a look at https://ychaouche.github.io/bash.txt,
but it is less of a "learn by doing" and more of a quick cheat sheet that helps you write or read bash code.

I use these two files (and more) to organize and quickly access knowledge gems,
so that once I learn something I need to remember 6 months from now,
I just look at one of the files
(or use my notes.search script,
but that's another topic).

Best,
--
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.
Richard Owlett
2024-09-09 11:30:02 UTC
Permalink
Post by Yassine Chaouche
Missed (deleted) the start of the discussion.
https://ychaouche.github.io/toolbox.txt
it is meant to be open in emacs,
so that you can use its outliner mode and read only what you're interested in.
I've never successfully used Emacs [an attempt made several months ago].
The GUI version is available on my machine.
Post by Yassine Chaouche
This is GNU Emacs 24.5.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-09-12 on x86-grnet-01, modified by Debian
How do I display/activate "outliner mode"?
Is appropriate "HELP" documentation of using "outliner mode" available
as web page?
Post by Yassine Chaouche
The relevant part is in "** command line tricks"
(https://i.imgur.com/eqBjD0n.png)
I tried to display in my browser (SeaMonkey 2.49.4) and got only an
empty dark gray screen.
Post by Yassine Chaouche
You can also take a look at https://ychaouche.github.io/bash.txt,
but it is less of a "learn by doing" and more of a quick cheat sheet
that helps you write or read bash code.
I assume that is also meant to be read using "outliner mode".

The notes will give me practice in reading French which I haven't done
since high school (1961).

Thanks for trying.
Post by Yassine Chaouche
I use these two files (and more) to organize and quickly access knowledge gems,
so that once I learn something I need to remember 6 months from now,
I just look at one of the files
(or use my notes.search script,
but that's another topic).
Best,
Richard Owlett
2024-09-09 12:20:01 UTC
Permalink
Post by Richard Owlett
Post by Yassine Chaouche
Missed (deleted) the start of the discussion.
https://ychaouche.github.io/toolbox.txt
it is meant to be open in emacs,
so that you can use its outliner mode and read only what you're interested in.
I've never successfully used Emacs [an attempt made several months ago].
The GUI version is available on my machine.
Post by Yassine Chaouche
This is GNU Emacs 24.5.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-12 on x86-grnet-01, modified by Debian
How do I display/activate "outliner mode"?
Is appropriate "HELP" documentation of using "outliner mode" available
as web page?
Yes ;}
https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html

I now have today's reading assignment. Retirement can be convenient.
Post by Richard Owlett
Post by Yassine Chaouche
The relevant part is in "** command line tricks"
(https://i.imgur.com/eqBjD0n.png)
I tried to display in my browser (SeaMonkey 2.49.4) and got only an
empty dark gray screen.
Post by Yassine Chaouche
You can also take a look at https://ychaouche.github.io/bash.txt,
but it is less of a "learn by doing" and more of a quick cheat sheet
that helps you write or read bash code.
I assume that is also meant to be read using "outliner mode".
The notes will give me practice in reading French which I haven't done
since high school (1961).
Thanks for trying.
Post by Yassine Chaouche
I use these two files (and more) to organize and quickly access knowledge gems,
so that once I learn something I need to remember 6 months from now,
I just look at one of the files
(or use my notes.search script,
but that's another topic).
Best,
George at Clug
2024-09-08 22:30:01 UTC
Permalink
Post by d***@howorth.org.uk
single focus reading glasses made to suit the distance their screen is
away.
For any prolonged activity:

1) Like others who have responded, I do the above and recommend the same: "single focus reading glasses made to suit the distance the screen is away". Maintaining that distance is important. I have a bad habit of rolling my office chair out of focal distance when just reading from the computer screen. It is important to maintain the correct focal distance the glasses are set to.
2) For close work like reading a book, solder circuit boards, or using a laptop on a desk (book reading distance), I use another pair of glasses set to the focal distance from me to where I hold a book.
3) To watch TV, I use a different pair of glasses set to the focal distance from me to the TV Screen.

This means I now use three pair of single focus glasses, all set to a different magnification and most importantly a different focal distance.

I do not require glasses for any other activity, my distance vision remains quite good. I can peel vegetables for dinner without the need for glasses as it is not a prolonged activity.

I did try multi focus glasses at one time, but it made walking difficult as glasses set to the focal distance for reading or for computer screens made the the path all blurred.

If I required glasses for reading the car's speedometer, then I would definitely be using a bifocal pair of glasses. So far I can easily read the instrument panel, and since most of the time we spend focusing on the traffic about us, a quick glance now and then to confirm the car's speed is under or at the current speed limit, I am able to drive for many hours.

While I expect this is far more information than the OP required, my hope it might help the OP or others. It took me too long to find a good optometrist who was able to explain and help me with appropriate glasses set to the required focal distance.

George
jeremy ardley
2024-09-09 00:40:01 UTC
Permalink
Post by George at Clug
If I required glasses for reading the car's speedometer, then I would
definitely be using a bifocal pair of glasses. So far I can easily read
the instrument panel, and since most of the time we spend focusing on
the traffic about us, a quick glance now and then to confirm the car's
speed is under or at the current speed limit, I am able to drive for
many hours.
The need for glasses increases with lower the light levels because the
pupil expands at low light and lense defects become much more obvious.

This is probably the reason I use black text on white background for
most of my computer work. White or green text on black is generally
harder to focus. Many of the 'dark' themes in editors are almost
unusable for me.

A second issue mostly unrelated to computer screens is astigmatism. I
was quite surprised when I started using 'driving' glasses about how
much clearer the road became. At night it is not really safe to drive
without them. The downside is that you can't see the instruments too well.
Larry Martell
2024-09-10 00:20:01 UTC
Permalink
Post by jeremy ardley
Post by George at Clug
If I required glasses for reading the car's speedometer, then I would
definitely be using a bifocal pair of glasses. So far I can easily read
the instrument panel, and since most of the time we spend focusing on
the traffic about us, a quick glance now and then to confirm the car's
speed is under or at the current speed limit, I am able to drive for
many hours.
The need for glasses increases with lower the light levels because the
pupil expands at low light and lense defects become much more obvious.
This is probably the reason I use black text on white background for
most of my computer work. White or green text on black is generally
harder to focus. Many of the 'dark' themes in editors are almost
unusable for me.
A second issue mostly unrelated to computer screens is astigmatism. I
was quite surprised when I started using 'driving' glasses about how
much clearer the road became. At night it is not really safe to drive
without them. The downside is that you can't see the instruments too well.
What are these driving glasses? I can no longer drive at night and
would love to know about them.
jeremy ardley
2024-09-10 01:10:01 UTC
Permalink
Post by Larry Martell
What are these driving glasses? I can no longer drive at night and
would love to know about them.
They are glasses that are set to focus at long distance, so no good for
desk.

They correct for astigmatism, so at night instead of point lights such
as a star being smeared, they are now back to the single points like
when you were young.

I got my first 'driving' glasses because I was having trouble seeing
distant screens in a large auditorium. I took them outside and the world
was suddenly much clearer! At night, driving was no longer the problem
it had become without me realising.
d***@howorth.org.uk
2024-09-10 12:40:01 UTC
Permalink
Post by Larry Martell
What are these driving glasses? I can no longer drive at night and
would love to know about them.
As well as uncorrected visual faults, such as short-sightedness or
astigmatism, another reason for not being able to drive at night is
cataracts. If so the [only] solution is to have them removed. Either
way, please visit an optician and trust what they say rather than
random people on the Internet.
Larry Martell
2024-09-10 14:50:01 UTC
Permalink
Post by d***@howorth.org.uk
Post by Larry Martell
What are these driving glasses? I can no longer drive at night and
would love to know about them.
As well as uncorrected visual faults, such as short-sightedness or
astigmatism, another reason for not being able to drive at night is
cataracts. If so the [only] solution is to have them removed. Either
way, please visit an optician and trust what they say rather than
random people on the Internet.
One would be better to see an ophthalmologist as opposed to an
optician. In my case I have had both a detached retina repaired and a
cataract removed in the same eye. Before that I wore contacts or
glasses for distance and reading glasses for computer work or reading
if I had my contacts in. Now I have 20/20 vision in the eye I had
surgeries on, and my unaltered 20/200 vision in the other eye. I've
tried various glasses and contacts since, but what has worked best for
me is what they call univision - I have distance sight in one eye and
close sight in the other. It took my brain around 2 years to adjust
and accept that. This works very well for me, but in low light I don't
have good depth perception and right lights are blinding to me, so I
don't drive at night any more. Would love to find something that could
help with that.
James H. H. Lampert
2024-09-10 16:00:01 UTC
Permalink
Post by Larry Martell
One would be better to see an ophthalmologist as opposed to an
optician.
Correct. An optician can only fill a prescription written by an
ophthalmologist or an optometrist. And depending on where you go for eye
care, and your own particular needs, you may need both: at Kaiser, I
learned early-on that ophthalmologists there will refer you to an
optometrist for routine eyeglass prescriptions, even if they are
examining you for other problems (e.g., vitreous shrinkage/liquefaction).

As to "driving glasses," "reading glasses," "computer/music desk
glasses," and so forth, prescriptions can be optimized for various needs
and various activities.

--
JHHL
d***@howorth.org.uk
2024-09-10 17:20:01 UTC
Permalink
Post by James H. H. Lampert
Post by Larry Martell
One would be better to see an ophthalmologist as opposed to an
optician.
Correct. An optician can only fill a prescription written by an
ophthalmologist or an optometrist. And depending on where you go for
eye care, and your own particular needs, you may need both: at
Kaiser, I learned early-on that ophthalmologists there will refer you
to an optometrist for routine eyeglass prescriptions, even if they
are examining you for other problems (e.g., vitreous
shrinkage/liquefaction).
I'm guessing both of you are in the US, whilst I'm in the UK. Here an
opthalmologist is a doctor working in a hospital, to whom I would have
to be referred by my GP. Wanting some spectacles isn't something my
GP or an opthalmologist would be interested in normally.

Opticians in this country come in two flavours: dispensing opticians
and optometrist. Normally they work together in a practice, although
there are a few practices without one or the other. It is thus common
to refer to an "optician" when meaning a private practitioner (or
collection thereof) who can prescribe and dispense spectacles.
Post by James H. H. Lampert
As to "driving glasses," "reading glasses," "computer/music desk
glasses," and so forth, prescriptions can be optimized for various
needs and various activities.
Indeed so, which is why I suggested visiting an optician. They are also
qualified to diagnose cataracts and to refer to an opthalmologist for
treatment as and when suitable.
e***@gmx.us
2024-09-10 20:30:01 UTC
Permalink
On Tue, 10 Sep 2024 08:54:21 -0700
Hello James and Larry,
Post by James H. H. Lampert
Correct. An optician can only fill a prescription written by an
ophthalmologist or an optometrist.
In the UK, Opticians businesses typically have on Optometrist on the
premises. Consequently, the term Optician is often used to include
Optometrists. A distinction is rarely made by the general public.
In my experience:
store | optometrist | optician
------------+-------------+----------
Walmart | ? | yes
former dr | yes | no
current dr | yes | yes
glasses src | yes | yes

So here, it's hit and miss. I agree about the name confusion.

--
I can offr you some indstrial-strngth Beef, Egg and Onion pies; srved
with a healthy amnt of bked beans, if that doesn't get your emissions
of Eggdimethyl Beansoxide up to a lvl which cnstitutes a violation of
the Geneva Convention on chmical wrfare, I don't know wht will. -Tanuki
Peter Ehlert
2024-09-13 17:00:01 UTC
Permalink
Post by d***@howorth.org.uk
Post by Larry Martell
What are these driving glasses? I can no longer drive at night and
would love to know about them.
As well as uncorrected visual faults, such as short-sightedness or
astigmatism, another reason for not being able to drive at night is
cataracts. If so the [only] solution is to have them removed. Either
way, please visit an optician and trust what they say rather than
random people on the Internet.
I have worn glasses since I was about 13 years old. Now I am 74.
near-sighted and astigmatism

I was darn happy to be able to see super close, especially when I get a
sliver or thorn.

just take to glasses off, and dig it out. go on with my day.

night vision became a challenge, especially while driving.

about a year ago I went to get new glasses, the optometrist said
"cataracts" you should see a ophthalmologist.
he made a big deal about the cataracts, and I felt he was just being a
salesman.
I just got new lenses....

So, in a nutshell, my Cataracts had the effect of looking through a
dirty windshield with dirty glasses.
the new glasses were barely compensating, not good.

July 4, 2024... I went back and had the cataract in my left eye worked on.
WOW! after a few days I was seeing better then I could remember ever.

one week later I had the cataract in my right eye corrected.
that eye took longer to heal, but it is super.

NOW: I must use reading glasses for close stuff, like a thorn. Computer
screen I can manage, cellphone too, but much better with readers. Dime
store readers suffice, but the professional built are better, they
correct for the astigmatism also.
Night driving, no problem at all.

I see more stars at night than I ever could.
Bonus: colors. apparently I had lost some color vision... now I see more
tones. sweet!

= don't hesitate to get checked out. Ask around for references.

Anssi Saari
2024-09-09 08:50:01 UTC
Permalink
Post by d***@howorth.org.uk
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I don't agree at all. I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses. I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.

So, not going back from my close range varifocals. I don't need glasses
otherwise.
Karl Vogel
2024-09-09 09:50:01 UTC
Permalink
Post by Anssi Saari
Post by d***@howorth.org.uk
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I don't agree at all. I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses. I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.
Have you tried some different fonts? My eyesight is poor, and a good
font made all the difference.

https://bezoar.org/posts/2023/0214/font-screenshots/
--
Karl Vogel I don't speak for anyone but myself

Debugging: when you're the detective, the victim, and the criminal.
--seen on Reddit, 11 Jul 2024
George at Clug
2024-09-09 10:00:01 UTC
Permalink
Post by Karl Vogel
Post by Anssi Saari
Post by d***@howorth.org.uk
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I don't agree at all. I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses. I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.
Have you tried some different fonts? My eyesight is poor, and a good
font made all the difference.
https://bezoar.org/posts/2023/0214/font-screenshots/
Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?

George.
Post by Karl Vogel
--
Karl Vogel I don't speak for anyone but myself
Debugging: when you're the detective, the victim, and the criminal.
--seen on Reddit, 11 Jul 2024
Anssi Saari
2024-09-10 09:10:01 UTC
Permalink
Post by George at Clug
Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?
In my home setup one monitor does 75 Hz and the other 144 but I can't
see much, if any, difference in clarity compared to 60 Hz. Also I have
no idea how to configure that in Debian, I just quickly tested with my
work Windows laptop.
George at Clug
2024-09-10 11:50:01 UTC
Permalink
Post by Anssi Saari
Post by George at Clug
Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?
In my home setup one monitor does 75 Hz and the other 144 but I can't
see much, if any, difference in clarity compared to 60 Hz. Also I have
no idea how to configure that in Debian, I just quickly tested with my
work Windows laptop.
Thanks Anssi, I find your comments very useful regard refresh rate.

I believe in most Linux's GUI settings for the Display, there will be a "Refresh rate" which appears to be user adjustable in XFCE, if the monitor supports multiple refresh rates, but for me, my monitors only support 60 Hz anyway so I cannot confirm. I don't know about Gnome or KDE? If anyone has a monitor that can do multiple refresh rates and use either Gnome or KDE, please let me know if they just use the highest refresh rate or if the refresh rate is user adjustable via the GUI's Display settings.

George.
e***@gmx.us
2024-09-09 14:00:01 UTC
Permalink
Post by Karl Vogel
Post by Anssi Saari
I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses. I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.
Have you tried some different fonts? My eyesight is poor, and a good
font made all the difference.
https://bezoar.org/posts/2023/0214/font-screenshots/
Indeed. I can't stand Courier or clones, too thin. I use Liberation Mono
usually.

--
"First, Do No Harm.

Always do harm second, after the user has proven that they earned it."
-- ObscureRefence on reddit
Anssi Saari
2024-09-10 09:10:01 UTC
Permalink
Post by Karl Vogel
Have you tried some different fonts? My eyesight is poor, and a good
font made all the difference.
https://bezoar.org/posts/2023/0214/font-screenshots/
Fonts on what? I mostly can't control fonts on documents I edit or
create, for work at least. A little hard to do on PDFs too, let alone
UIs.

With fixed width fonts, terminals and Emacs is where I have the most
choice, and there it's one of Input, Consolas or Meslo LG in different
environments.
Lee
2024-09-10 12:10:02 UTC
Permalink
Post by Anssi Saari
Post by Karl Vogel
Have you tried some different fonts? My eyesight is poor, and a good
font made all the difference.
https://bezoar.org/posts/2023/0214/font-screenshots/
Fonts on what? I mostly can't control fonts on documents I edit or
create, for work at least. A little hard to do on PDFs too, let alone
UIs.
Try changing the display dots per inch setting. In xfce it's under
settings / appearance
select the 'fonts' tab, check 'Custom DPI setting' and try a larger dpi
number than whatever you've got.
My desktop defaults to 96 dpi and that's fine for me. My laptop also
defaults to 96 but I need to bump that up to 120 to easily read the screen
- even with 'computer' glasses.

Regards
Lee
George at Clug
2024-09-09 10:00:01 UTC
Permalink
Post by Anssi Saari
Post by d***@howorth.org.uk
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs for
reading a computer screen. Tell them to get a [very cheap] pair of
single focus reading glasses made to suit the distance their screen is
away.
I don't agree at all. I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses.
Anssi, thank you for posting your experiences. This technology was suggested to me but it was explained the left/right sides could be blurry, so I declined to try them, which is a bit sad, because maybe they would have worked for me.

https://lowcostglasses.co.uk/common-problems-with-varifocal-glasses/

https://www.glassesdirect.co.uk/buying-guides/lens-options/varifocal-lenses-explained/
Post by Anssi Saari
I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.
I can report that single (large area) focus glasses work exceptionally for me when using three monitors (I like using 24" or even better 27" HD monitors). As long as each monitor is still about the distance of my outstretched arm, creating a semicircle around where I sit. I find it very difficult to use just one monitor. The great thing about single focused glasses is that I can use peripheral vision to see all of the screen in focus without needing to turn my head or move my head up and down. Using single (large area) focus glasses saves me a lot of head turning that would be required to keep my centre of vision at the point at which I am reading on the screen.

I so want to try a 65" OLED curved widescreen monitor, but my budget is multiple second hand 1080p monitors.

I do agree with you, the draw back with single focal glasses is if I am working with paper that is closer to me than the monitors, or if I am looking at a whiteboard as in a classroom that is further away from me than my monitors. In these cases I expect that trifocal or varifocal glasses would be preferred, though I have yet to use either on a long term basis.

Fortunately my use of paper or laptop screen is rare. I use two or three large screen displays for my long periods of work. I do use a laptop when travelling and use reading glasses when doing so, not my computer monitor glasses.
Post by Anssi Saari
So, not going back from my close range varifocals. I don't need glasses
otherwise.
If verifocals work for you, you do not need to do anything else !

Again, thank you for sharing your views and experiences, this does help me. I would like to try using varifocal glasses for classroom environments, as this is definitely when my single focus glasses do not quite do the job.

George.
Sirius
2024-09-08 05:40:01 UTC
Permalink
Post by Richard Owlett
This started with be exploring "regular expressions".
I discovered some tutorials that were using Bash in their samples.
One {lost the reference at the moment} was almost a match for a real
world problem I have.
Bash has some nifty uses when it comes to variables.

If you just want to store a file in a variable,
VAR="$(</path/to/file)
will do it. If you want to do an array instead, use the 'while read line;
do' construct. As others have pointed out, this is not an optimal usecase
for bash.

Perl on the other hand is well suited for manipulating text (it was the
main reason for its creation) and has a good regexp engine built in. AWK
is also a useful tool for manipulating text, a bit depending on the
structure of it.
Post by Richard Owlett
But I've not used Bash in eons and have forgotten how to read a file
into a single variable or a array variable.
See above.

However, you may be picking the wrong hammer for cracking this particular
nut. As other pointed out, both Python and Perl have modules specifically
targeted at handling SGML/XML/HTML which was something you wanted to
process. Do not re-invent the wheel.

You can still code the harness in Bash if you want, but use a better tool
for processing the input files. No need to go to C/C++ or something like
Go for that. Perl or Python will do just fine.
Post by Richard Owlett
I've downloaded "Bash Reference Manual"
[https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html] for
when I need fine grained details.
I've bookmarked the various links on
[https://mywiki.wooledge.org/BashFAQ]
for quick reference.
I find neither to be search friendly.
The Bash Manual page is actually quite encompassing and very useful. While
it might not have a lot of examples as such, it does showcase what is
available within Bash itself. Besides that, the O'Reilly book on Bash has
served me well. I have quite a few O'Reilly books and they are all full of
examples and detailed explanations. Even the small quick reference books
they do for things are worthwhile picking up. If you do pick up the Bash
book, might I suggest you add the Sed & Awk book at the same time.

It is very common to code something in bash and either call out to sed or
awk for processing something, depending on the structure of what is
processed. Those three tools often go hand in hand and if you plan on
writing larger projects in Bash, you will want to cover Sed and Awk as
well.
Post by Richard Owlett
Suggestions?
TIA
--
Kind regards,

/S
Greg Wooledge
2024-09-08 14:00:01 UTC
Permalink
Post by Sirius
Bash has some nifty uses when it comes to variables.
If you just want to store a file in a variable,
VAR="$(</path/to/file)
will do it. If you want to do an array instead, use the 'while read line;
do' construct. As others have pointed out, this is not an optimal usecase
for bash.
Unless you're targeting very old versions of bash, you can read the lines
of a file/stream into an array with the "readarray" (or "mapfile") command.
You can specify a single character to act as the line terminator, or
let the default newline character $'\n' be used. In sufficiently new
versions of bash, you can specify '' to use NUL as the line terminator.

For example, in bash 4.4 or higher:

readarray -t -d '' myfiles < <(
find . -type f -print0
)

You almost always want the -t option, to strip the delimiter from the
array elements. In the case of NUL, it makes no difference, but it's
a good habit to have if you ever use this technique on text files.

Just to reiterate what others have said: do *not* use bash's text
processing tools or regular-expression-based techniques to parse HTML.
See <https://stackoverflow.com/q/1732348>.
Charlie Gibbs
2024-09-09 17:10:01 UTC
Permalink
On Mon Sep 9 09:07:11 2024
Post by Anssi Saari
Post by d***@howorth.org.uk
As a mere bifocal (well vari-focal) wearer can I suggest a different
approach. Stop wearing tri-focals or any other variable focus specs
for reading a computer screen. Tell them to get a [very cheap] pair
of single focus reading glasses made to suit the distance their
screen is away.
I don't agree at all. I've used fixed focus glasses before but I find
close range varifocals a huge upgrade. They're extremely useful for
monitor work *and also* I can see and read things around me that fall
outside the extremely narrow focus range of single focus reading
glasses. I wonder if fixed focus even works for modern large two or
three monitor setups? I suppose it's fine for a single small screen.
So, not going back from my close range varifocals. I don't need
glasses otherwise.
I can't imagine having to manage multiple pairs of glasses. It would
drive me insane. This would also be the consequence of having cataract
surgery that gives you perfect distance vision at the cost of your
close-up vision. I'm nearsighted and have worn glasses since I was
about 10, so wearing glasses is no big deal for me. I'm now wearing
progressive lenses; yes, they take some getting used to at first,
and you have to be careful on stairs, but on it's well worth the
convenience. I put them on in the morning and take them off when
I go to bed - no worrying about where I left those damned reading
glasses.

When I got cataract surgery, I told the doctor to leave my nearsighted
vision the way it is and let the glasses handle it. I can focus on
computer screens well enough, and when I'm driving the shift from the
instrument panel to distance and back has become automatic. If I want
to look at something really close (like my wife's eyes), I take off my
glasses, or look over them. Your mileage may vary.

I did once get a pair of single-focus glasses made that focused at the
distance of a computer screen (or music stand). Just after I picked
them up, my eyes changed, and the glasses then focused at 8 feet.
Two hundred dollars wasted.
--
/~\ Charlie Gibbs | We'll go down in history as
\ / <***@kltpzyxm.invalid> | the first society that wouldn't
X I'm really at ac.dekanfrus | save itself because it wasn't
/ \ if you read it the right way. | cost-effective. -- Kurt Vonnegut
Loading...