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

Re: subsitutions and beginning of lines.



Ray Andrews wrote on Sun, Oct 11, 2015 at 12:12:26 -0700:
> ${var// /}
> 
> When doing that sort of substitution, is is possible to test for newlines?
> I'm playing with a function that grabs history and I'm trying to strip
> off the leading numbers.

If you're trying to parse something like this:

    % history | tail -2
     1004  echo foo
     1005  echo bar

You could avoid parsing the line numbers (and unescaping the commands)
altogether by accessing the history differently:

    % print -r - $history[1004]
    echo foo



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