Re: 'exec -a' and $0 substitution

2023-01-25 Thread Lawrence Velázquez
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 name. Is it an intended behaviour that could not be > easily changed?

Re: 'exec -a' and $0 substitution

2023-01-25 Thread alex xmb ratchev
root@localhost:~# unset -v z ; cat srcpath ; bash srcpath ; ./srcpath ; "${z=$PWD/srcpath}" ; bash "$z" [[ ${z=$BASH_SOURCE} == /* ]] && t=$z || t=$PWD/$z printf %s\\n "$t" /root/srcpath /root/./srcpath /root/srcpath /root/srcpath On Thu, Jan 26, 2023, 12:51 AM Sergei Trofimovich wrote: > Hello

'exec -a' and $0 substitution

2023-01-25 Thread Sergei Trofimovich
Hello bash maintainers! nixpkgs package collection likes to wrap binaies and shell scripts to pass extra environment variables via wrappers. One example is dejagnu's runtest: $ cat `which runtest` | unnix #! /<>/bash-5.2-p15/bin/bash -e PATH=... export PATH exec -a "$0" "/<>/d

Re: More convenient tracing

2023-01-25 Thread Greg Wooledge
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 you got BASH_ENV set to something i

More convenient tracing

2023-01-25 Thread Dale R. Worley
Some time ago I proposed a new option to Bash to cause it to trace commands (in the manner of -x) but not within the Bash initialization scripts. People advised me that this could be accomplished without a new option. I also picked up various suggestions for how to design it. This is my latest v