|
From: | Marc Aurèle La France |
Subject: | Re: Bash 5.1: Make shell_script_filename available to startup files |
Date: | Sat, 17 Feb 2024 13:44:07 -0700 (Mountain Standard Time) |
User-agent: | Alpine 2.20 (WNT 67 2015-01-07) |
On Sat, 2024-Feb-17, Zachary Santer wrote:
On Fri, Feb 16, 2024, Marc Aurèle La France wrote:On Fri, 2024-Feb-16, Zachary Santer wrote:
And you're sure ${BASH_SOURCE[0]} wasn't what you wanted all along?
Yes, but that doesn't matter now.
At the bottom of my .bashrc file: printf '%s\n' "Hello, this script is ${BASH_SOURCE[0]}"
I start a new terminal and get: Hello, this script is /home/zsant/.bashrc
How is this not what you wanted?
Do ... rm -fr GREPME grepme echo '#! /bin/bash\nset' > GREPME "ln" GREPME grepme chmod a+x grepme ... then (case matters) ... BASH_ENV=GREPME ./grepme | fgrep -iw grepme ... gives ... BASH_ARGV=([0]="GREPME") BASH_ENV=GREPME BASH_SOURCE=([0]="GREPME") _=./grepme BASH_ENV=GREPME BASH_SOURCE=([0]="./grepme") ... so $_ wins, not $BASH_SOURCE[0] Marc.
[Prev in Thread] | Current Thread | [Next in Thread] |