Skip to main content
typo-fix
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session, I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comandcommand get the wrong result for the sz function?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session, I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F command get the wrong result for the sz function?

Tweeted twitter.com/StackUnix/status/1001955351485472768
Simple is better than complex
Source Link
jalanb
  • 598
  • 4
  • 17

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function? Do I need extra options (to the command itself or shopt)?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function? Do I need extra options (to the command itself or shopt)?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function?

Slight boasting
Source Link
jalanb
  • 598
  • 4
  • 17

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function? Do I need extra options (to the command itself or shopt)?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function? Do I need extra options (to the command itself or shopt)?

I have 2 small functions to abbreviate set -x / set +x, namely:

sx () {
    export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
    set -x
}

and

sz () {
    set +x
    export PS4=
}

These 2 functions are in a file functons.sh which is sourced from ~/.bashrc, and visible online here.

Immediately after logging in to a new bash session I try to find out where the sz() function is like this:

$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh

This shows that bash thinks the sz() function is declared in z.sh, but at that line there is a different function, zzz(), online here.

The result for the sx() function (and all my myriad other functions) is correct

$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh

Why does the declare -F comand get the wrong result for the sz function? Do I need extra options (to the command itself or shopt)?

Update URLs (point to the code before I put in the fix)
Source Link
jalanb
  • 598
  • 4
  • 17
Loading
Source Link
jalanb
  • 598
  • 4
  • 17
Loading