You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you need to capture the output of a function/command in bash you have pretty limited options.
The simplest way is: variable=$(function arg1 arg2)
The problem is that this way the function runs in a subshell. That usually doesn't matter. However, unlike other functions and commands bindfunc changes the current shell session (by adding the bindings) and when we run it in a subshell these changes stay in the subshell and don't affect the current shell.
There are some ways to capture the output of a function without running it in a subshell but none of them is simple.
To make the use of bindfunc simple and comfortable we use _bindfunc_revert as a special variable that holds the returned revert command.
If you have a better idea feel free to comment.
curusarn
changed the title
Why does --revert option use a variable (_bindfunc_revert) instead of printing to stdout
Why does --revert option use a variable instead of printing to stdout
Dec 12, 2019
Why not return the revert command using standard output instead of using
_bindfunc_revert
variable.Then you could use it just like
ssh-agent
:The text was updated successfully, but these errors were encountered: