[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare -F incorrect line number
From: |
Robert Elz |
Subject: |
Re: declare -F incorrect line number |
Date: |
Thu, 06 Oct 2022 05:29:30 +0700 |
Date: Wed, 5 Oct 2022 15:36:55 -0400
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <3d89acac-4c0a-64c9-e22c-1a3ca68600d1@case.edu>
| Other than that, there's no advantage.
There can be. I have, on occasion (not in bash - I don't
write bash scripts) had a need to redefine one of the standard
commands, while executing a particular function (which calls other
more standard functions which run the command) - and define the
same command differently when running a different function, which
runs the same standard functions running the command, but in a
different way.
Kind of like
f1() {
diff() { command diff -u "$@"; }
dostuff
unset -f diff
}
f2() {
diff() { command diff -iw -c "$@"; }
dostuff
unset -f diff
}
where dostuff() does what ever is needed to make "newversion",
and then, somewhere does one (or more) of something like
diff origfile newversion
"dostuff" can also just be run to get the default diff format.
or something like that. Real examples tend to be far more complicated
(this simple case could be done just by having DIFFARGS or something, but
that would mean modifying dostuff() to use that as diff $DIFFARGS ....)
kre
- declare -F incorrect line number, Daniel Castro, 2022/10/02
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/05
- RE: declare -F incorrect line number, Daniel Castro, 2022/10/05
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/05
- Re: declare -F incorrect line number,
Robert Elz <=
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/06
- Re: declare -F incorrect line number, Martin D Kealey, 2022/10/06
- Re: declare -F incorrect line number, Greg Wooledge, 2022/10/06
- Re: declare -F incorrect line number, Martin D Kealey, 2022/10/11
Re: declare -F incorrect line number, Chet Ramey, 2022/10/08