Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

have zsh invoke a command/script but not exit



Hello,

Is it possible to start zsh and invoke some other command/script but upon command completion to return to interactive mode rather than exit from zsh? Something like this:

zsh -i -c ls

so that after the ls command is finished I'm left in an interactive shell.

The only way I can think off is to put some hack in my .zshrc where if some env variable is set it will run that command at the end of my .zshrc file, e.g.

RUN_CMD='ls *.txt' zsh -i

and .zshrc would check for $RUN_CMD and run it at the end.

But even this way I'm struggling with arguments passed to my command, how would I run RUN_CMD from .zshrc? Would this be the way to do it:

eval "$RUN_CMD"

Is there a better way to do it?

Thanks for your help.

--
Tim



Messages sorted by: Reverse Date, Date, Thread, Author