Re: Name collision with nameref and local variable
On 10/16/20 11:23 AM, gri...@sun.stat.cwru.edu wrote: > Bash Version: 5.0 > Patch Level: 18 > Release Status: release > > Description: > This worked just fine on Bash 4.2: > > foo() { > local -a args=("${!1}") > echo "[IN] ${args[@]}" > } > > declare -a args=("$@") > echo "Bash ${BASH_VERSION}" > echo "[OUT] ${args[@]}" > foo args[@] > > eg. > $ ./test.sh 1 2 3 Thanks for the report. There aren't any nameref variables there; this is an order-of-evaluation problem resulting from the local array variable declaration with the same name as the variable used in the word expansion -- it doesn't depend on the indirect variable expansion. It was fixed back in April, before bash-5.1-alpha was released. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Re: Bash Reference Mamual
I get it now. Thanks for your friendly and informative replies. :) Craig > On Oct 17, 2020, at 7:45 PM, Lawrence Velázquez wrote: > >> On Oct 17, 2020, at 7:35 PM, Eduardo Bustamante wrote: >> >> <(cat file) and $(cat file) are not equivalent constructs. The former will >> expand to a file name (e.g. "/dev/fd/63"), whereas the latter will expand >> to the contents of the file. > > If you want terms you can look up, $(cat file) and $(< file) are > *command substitutions*, while <(cat file) is a *process substitution*. > > $ printf 'FILE CONTENTS' >tmp > $ printf '|%s|\n' "$(cat tmp)" > |FILE CONTENTS| > $ printf '|%s|\n' "$(< tmp)" > |FILE CONTENTS| > $ printf '|%s|\n' "<(cat tmp)" > |<(cat tmp)| > $ printf '|%s|\n' <(cat tmp) > |/dev/fd/63| > > > -- > vq
problem with using ctrl-x ctrl-e ( open vi editor )
Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux EliteBook 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 17 Release Status: release # bash$ cat <<\EOF # without using ctrl-x ctrl-e there is no problem occurred. > 111 > 222 > EOF 111 222 --- bash$ cat <<\EOF > 111 > < in this line open vi editor with ctrl-x ctrl-e and add another 222 line then :wq bash$ cat <<\EOF > 111 > cat <<\EOF 111 222 EOF 111< successfully executed cat command with heredoc 222 > > > > ^C < but does not end ">" prompt until enter ctrl-c