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

Re: write a command line.

On Sat, Apr 14, 2012 at 8:43 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> It's mostly a question of knowing how to express the problem.

This can indeed be the most difficult part, particularly becoming
familiar with the terminology.  Just as an example:

> Now I can just create my command inside
> the script, save it as '$string' and: 'print -z $string'  does the trick.

Usually a "script" refers to something that runs as a stand-alone
program separate from an interactive shell.  "print -z" in a script
would be meaningless, whereas your original solution of appending to
the incrementally-shared history file works perfectly for such an
external program.  If "print -z" really works for you, you must be
referring to a "function" rather than a "script.

> The way I've expressed it, people seem
> to think I'm looking for something complicated.

An extremely common mistake is:

I have problem X.  I come up with a solution which involves steps A,
B, C, and D, but I run into a problem at step C.  Instead of
describing the original problem X, I attempt to describe the execution
of C, and everyone gets lost in the details.  If I'd described X in
the first place, I might have learned that I was already going wrong
at step B, which is why C is causing such a headache.

The best part about starting with X is that *usually* the description
of X does not need to discuss whether the solution involves a script
or a function or any of the other terminology that might cause

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