Linux command
getln 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Read a line from the buffer stack into a variable
getln [variable_name]
Read a line and process it
getln line && echo $line
Push a line then retrieve it
print -z "hello world" && getln [variable_name]
说明
getln is a zsh builtin that reads the top entry from the shell's buffer stack and assigns it to the named variable. It is equivalent to read -zr. The buffer stack is a LIFO (last-in, first-out) data structure where lines can be pushed using print -z or pushln and later retrieved with getln. If multiple variable names are given, the line is split into words and assigned to each variable in order, similar to read. The line is read without word splitting on the whole (the -r behavior). The buffer stack is typically used for programmatic input manipulation, where a script prepares command lines to be executed or processed later.
FAQ
What is the getln command used for?
getln is a zsh builtin that reads the top entry from the shell's buffer stack and assigns it to the named variable. It is equivalent to read -zr. The buffer stack is a LIFO (last-in, first-out) data structure where lines can be pushed using print -z or pushln and later retrieved with getln. If multiple variable names are given, the line is split into words and assigned to each variable in order, similar to read. The line is read without word splitting on the whole (the -r behavior). The buffer stack is typically used for programmatic input manipulation, where a script prepares command lines to be executed or processed later.
How do I run a basic getln example?
Run `getln [variable_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more getln examples?
This page includes 3 examples for getln, plus related commands for nearby Linux tasks.