Re: 'exec -a' and $0 substitution

2023-01-26 Thread Martin D Kealey
On Thu, 26 Jan 2023, 09:37 Sergei Trofimovich, wrote: > To the bug: looks like 'exec -a' does not work for bash scripts, but does > work for other executables. > Be aware that the kernel is responsible for interpreting #! lines, not bash. The kernel does several steps when it encounters an exec

Re: More convenient tracing

2023-01-26 Thread Greg Wooledge
On Thu, Jan 26, 2023 at 12:03:08PM -0500, Dale R. Worley wrote: > I do have BASH_ENV set, to ~/.bashrc. I need that so that my scripts > can use my .bashrc customizations. I strongly advise against this. All of the things a script does should be discoverable by reading the script, and any files

Re: More convenient tracing

2023-01-26 Thread Dale R. Worley
Greg Wooledge writes: > On Wed, Jan 25, 2023 at 03:00:27PM -0500, Dale R. Worley wrote: >> >> Tracing with -x prints a lot of (usually) useless lines. >> >> $ bash -x ./tt >> [300+ lines of Bash initializations] >> + echo 'Now in tt.' >> Now in tt. > > Why does it do this? Have

Re: 'exec -a' and $0 substitution

2023-01-26 Thread Sergei Trofimovich
On Thu, 26 Jan 2023 00:35:27 -0500 Lawrence Velázquez wrote: > On Wed, Jan 25, 2023, at 6:37 PM, Sergei Trofimovich wrote: > > I fear it's a side-effect of the way 'bash' gets executed via shebang by > > kernel. But maybe not? Somehow direct script execution still manages to > > preserve script's