$mapfile
–
Mapping of files of the current directory
$mapfile
contains a mapping of the files inside the current directory and allows for easy interaction with the files and their content.
Reading a value yields the content of the file. Modifying a value writes to the file. Unsetting a value removes the files on disk.
Links
Examples
- Print file content using
$mapfile
and then remove it - Output:
1 2 3 4 5
zmodload zsh/mapfile echo -e "hello world\nbye" > test-file echo "${mapfile[test-file]}" unset "mapfile[test-file]"
1 2
hello world bye
BashSupport Pro 是一款支持 mapfile** 的 **Zsh 集成开发环境 - 立即试用!