On Mon, Jan 01, 2024 at 04:38:20PM -0500, Federer Fanatic wrote: > Consider the following: > > shopt -s extdebug > mapfile -d" " < <(declare -F <bash_function_in_some_rc_file)
Unfortunately, you're not giving us enough details to reproduce this problem. What's in the file? Are you sure this is the correct syntax for reproducing the problem? > Results in the array MAPFILE having 3 entries with '2' entry containing the > filename > of bash function initial defining line I don't think this is correct. You're showing the command "declare -F < file" but declare -F doesn't read stdin at all. unicorn:~$ declare -F declare -f crawl declare -f fput declare -f git [...] unicorn:~$ echo 'f() { echo f; }' > x unicorn:~$ mapfile -d" " < <(declare -F <x) unicorn:~$ declare -p MAPFILE declare -a MAPFILE=([0]="declare " [1]="-f " [2]=$'crawl\ndeclare ' [3]="-f " [4]=$'fput\ndeclare ' [...] > $ vim "${MAPFILE[2}}" causes failure, not just for vim but cat for > example, however *What* failure? > $ vim ${MAPFILE[2]} does not add '^@' at the end of the fle name, Without seeing what's actually in your MAPFILE array, it's hard to understand what you're saying here. ^@ is how vim displays a NUL byte. Are you simply trying to edit a binary file? That would very likely give you some instances of ^@ on your screen, one for each NUL byte in the currently-visible part of the file. Also, your bug report doesn't include which version of bash you're running. Please tell us: * Which version of bash. * What's in the file you're using. * The *exact* command you're running, including the filename. * The actual output you get. Please be sure to include "declare -p MAPFILE" to show the contents of the array.