I'm trying to run a line from history by piping it into zsh with:
cat ~/.zsh_history | cut -d ';' -f 2 | sk --tac | zsh
This works if the line I pick interactively with
sk is a command that is available in the
But if it is something with an alias, like
ck, instead of running the expansion
cd .. && ls, I get a "command not found" error.
Edit: also, if I type:
echo "cd .. && ls" | zsh
It prints the output of running
ls in the parent directory, but when the command exits, I get back to the original prompt in the child directory. Is there a way to make zsh treat the thing piped into it as if I had typed it manually in the prompt and hit enter?