• Bit Twister

    From faeychild@2:250/1 to All on Tue Feb 16 22:08:04 2021

    What do you get when you enter

    echo $-net-nic (dashes NOT underscore)

    ~]$ echo $-net-nic
    himBHsnet-nic


    ~]$ echo $_net_nic
    enp0s31f6


    A typo turns up something interesting.

    Regards


    --
    faeychild
    Running plasmashell 5.15.4 on 5.10.8-desktop-2.mga7 kernel.
    Mageia release 7 (Official) for x86_64 installed via Mageia-7-x86_64-DVD.iso


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From David W. Hodgins@2:250/1 to All on Tue Feb 16 22:26:42 2021
    On Tue, 16 Feb 2021 17:08:04 -0500, faeychild <faeychild@nomail.afraid.org> wrote:
    What do you get when you enter
    echo $-net-nic (dashes NOT underscore)
    ~]$ echo $-net-nic
    himBHsnet-nic

    The $- has a specific meaning in bash ...
    $ echo $-
    himBHs

    In the section "Special Parameters" of "man bash"
    - Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself (such as the -i
    option).

    Regards, Dave Hodgins

    --
    Change dwhodgins@nomail.afraid.org to davidwhodgins@teksavvy.com for
    email replies.

    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From Aragorn@2:250/1 to All on Wed Feb 17 01:11:49 2021
    On 16.02.2021 at 17:26, David W. Hodgins scribbled:

    On Tue, 16 Feb 2021 17:08:04 -0500, faeychild
    <faeychild@nomail.afraid.org> wrote:
    What do you get when you enter
    echo $-net-nic (dashes NOT underscore)
    ~]$ echo $-net-nic
    himBHsnet-nic

    The $- has a specific meaning in bash ...
    $ echo $-
    himBHs

    In the section "Special Parameters" of "man bash"
    - Expands to the current option flags as specified
    upon invocation, by the set builtin command, or those set by the
    shell itself (such as the -i option).

    I'm not sure what faeychild is attempting to accomplish, but if that
    really is the name of a variable, then he should use ${-net-nic}
    instead to avoid shell expansion of the special $- builtin.


    --
    With respect,
    = Aragorn =


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Strider (2:250/1@fidonet)
  • From Bit Twister@2:250/1 to All on Wed Feb 17 08:11:21 2021
    On Wed, 17 Feb 2021 09:08:04 +1100, faeychild wrote:

    What do you get when you enter

    echo $-net-nic (dashes NOT underscore)

    ~]$ echo $-net-nic
    himBHsnet-nic


    I get the same thing

    ~]$ echo $_net_nic
    enp0s31f6


    A typo turns up something interesting.


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From faeychild@2:250/1 to All on Wed Feb 17 20:03:41 2021
    On 17/2/21 7:11 pm, Bit Twister wrote:
    On Wed, 17 Feb 2021 09:08:04 +1100, faeychild wrote:

    What do you get when you enter

    echo $-net-nic (dashes NOT underscore)

    ~]$ echo $-net-nic
    himBHsnet-nic


    I get the same thing

    ~]$ echo $_net_nic
    enp0s31f6


    A typo turns up something interesting.



    David's explanation is on the ball
    "$-" means something independent of the rest of the command

    ~]$ $-
    bash: himBHs: command not found

    Rule No 1. Do not begin variable names with dash :-)




    --
    faeychild
    Running plasmashell 5.15.4 on 5.10.8-desktop-2.mga7 kernel.
    Mageia release 7 (Official) for x86_64 installed via Mageia-7-x86_64-DVD.iso


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From faeychild@2:250/1 to All on Wed Feb 17 20:05:55 2021
    On 17/2/21 9:26 am, David W. Hodgins wrote:
    On Tue, 16 Feb 2021 17:08:04 -0500, faeychild
    <faeychild@nomail.afraid.org> wrote:
    What do you get when you enter
    echo $-net-nic  (dashes NOT underscore)
    ~]$ echo $-net-nic
    himBHsnet-nic

    The $- has a specific meaning in bash ...
    $ echo $-
    himBHs

    In the section "Special Parameters" of "man bash"
           -      Expands  to  the  current option flags as specified upon
    invocation, by the set builtin command, or those set by the shell itself (such as the -i
                  option).

    Regards, Dave Hodgins



    Thanks Dave./

    I love/hate stumbling across stuff that could result in a second career.

    regards

    --
    faeychild
    Running plasmashell 5.15.4 on 5.10.8-desktop-2.mga7 kernel.
    Mageia release 7 (Official) for x86_64 installed via Mageia-7-x86_64-DVD.iso


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From William Unruh@2:250/1 to All on Wed Feb 17 22:42:38 2021
    On 2021-02-17, Bit Twister <BitTwister@mouse-potato.com> wrote:
    On Wed, 17 Feb 2021 09:08:04 +1100, faeychild wrote:

    What do you get when you enter

    echo $-net-nic (dashes NOT underscore)

    ~]$ echo $-net-nic
    himBHsnet-nic


    I get the same thing

    ~]$ echo $_net_nic
    enp0s31f6


    A typo turns up something interesting.


    $- displays a bunch of bash flags, that have probably been turned on by default.

    h Remember the location of commands as they are looked up for execution. This
    is enabled by default
    (I am not sure what that means)
    i bash is interactive (eg on a terminal)
    m Job control enabled.
    B brace expansion. (eg, rm /var/log/{message,syslog}* )
    H ! history expansion is on. (!vi will expand to the last command
    which started with "vi")


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From David W. Hodgins@2:250/1 to All on Wed Feb 17 23:49:01 2021
    On Wed, 17 Feb 2021 17:42:38 -0500, William Unruh <unruh@invalid.ca> wrote:
    $- displays a bunch of bash flags, that have probably been turned on by default.
    h Remember the location of commands as they are looked up for execution. This
    is enabled by default
    (I am not sure what that means)

    When a command is executed, bash searches the path to find it the first time it's
    executed. That location is stored. See the output of "hash -l" for list of commands
    you or scripts used by the system have used that have been stored in a table to save time finding them the next time they are executed.

    Regads, Dave Hodgins

    --
    Change dwhodgins@nomail.afraid.org to davidwhodgins@teksavvy.com for
    email replies.

    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From Aragorn@2:250/1 to All on Thu Feb 18 00:27:56 2021
    On 17.02.2021 at 22:42, William Unruh scribbled:

    $- displays a bunch of bash flags, that have probably been turned on
    by default.

    h Remember the location of commands as they are looked up for
    execution. This is enabled by default
    (I am not sure what that means)

    It's a cache in RAM of the paths to frequently used executables, so
    that the shell doesn't have to ask the kernel to look for those
    executables in all the directories of the $PATH again every time the executables in question are invoked.

    --
    With respect,
    = Aragorn =


    --- MBSE BBS v1.0.7.21 (GNU/Linux-x86_64)
    * Origin: A noiseless patient Strider (2:250/1@fidonet)