On 17/6/24 19:15, to...@tuxteam.de wrote:
On Mon, Jun 17, 2024 at 06:47:41PM +1000, Keith Bainbridge wrote:

On 17/6/24 14:20, David Wright wrote:
Just some random thoughts:

On Sun 16 Jun 2024 at 18:13:36 (+1000), Keith Bainbridge wrote:

[...]

All the aliases that lie textually after the one with the missing '
will remain undefined, so you can use bisection to locate where in
the file problem lies.


If I didn't use a syntax matching editor this may have easily been my
problem.

I'm still pretty convinced that you're looking at a syntax problem.

Shell syntax is... not always trivial. I wouldn't trust most text editors
100% on that.

One thing you might try is to run your file through "bash -n" which checks
syntax without executing (well: it tries to: with languages like shell,
this is actually practically impossible).

Another thing would be to share your whole script here, but then you'll
want to make sure that there's nothing in there you want to consider
confidential.

Cheers

Good evening Tomas

bash -n on the original file (copied to a different name) through an error for a different alias from yesterday's efforts. So I added some blank lines. The error line number increased. Deleted a few lines of text - ctrl-x to clip board manager - The error line number reduced. Repeated the delete bit a few more times, with the error moving accordingly.

So I pasted about 5 aliases and some blank space and a function name to a /tmp/file. bash -n reported an error in a blank line between the previously reported error and the function name. Added a few more aliases after the function and 2 syntax errors were report in one of these additional aliases. Deleted the function name - no errors.

I was checking the /tmp/file in less regularly with no apparent extra characters appearing.

So pasted the previously 'errant' aliases back to .bash_aliases - no error. So pasted back the rest of the cut aliases. Still no error.

I know that at some point of my research I noticed that the { on the 2nd line of the function had moved up -- next to the name () and I think the first command was also on the first line. Can't say where I got that idea, but wish I knew, if only to warn folk off the site.

So Tomas, you're correct:Shell syntax is... not always trivial. I wouldn't trust most text editors 100% on that.

BUT how do we know where to look if the error is reported several lines above it's true position - admittedly blank lines; but?


So, I put the function name back in the /tmp/file but with no blanks above it, and got the 2 syntax errors on 1 line as before. Deleted all text below the function name, and the error line is now in the blank space below the function name. Delete all blanks after the function () and saving the file inserts a blank line - where the error is now reported.

Thanks everyone. Enjoy your Monday. Mines almost over.

17Jun2024@22:00:38

--
All the best

Keith Bainbridge

keithr...@gmail.com
keith.bainbridge.3...@gmail.com
+61 (0)447 667 468

UTC + 10:00

Reply via email to