From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: '$1' indexing.
Date: Thu, 22 Dec 2011 15:42:51 -0800 [thread overview]
Message-ID: <4EF3C07B.4040604@eastlink.ca> (raw)
In-Reply-To: <20111222230108.GA32237@miek.nl>
Hi!
First post. I thought I'd try zsh given how well spoken about it is. My
first exercise has been to try to convert my bash functions to zsh, and
it has not gone smoothly, but most problems have proved to be solvable.
But what do you guys think of this:
function z
{
var=$1
echo "var:/${1:0:1}/${1:1:1}/${1:2:1}/"
echo "var:/${var:0:1}/${var:1:1}/${var:2:1}/"
}
$ z abcde
var: /a/a/b/
var: /a/b/c/
Surely the indexing of '$1' is wrong? I can assign the value to 'var'
and all is well but I don't think I should have to.
Thoughts?
next prev parent reply other threads:[~2011-12-22 23:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 10:11 default to file completion Miek Gieben
2011-12-18 13:57 ` Mikael Magnusson
2011-12-18 15:20 ` Miek Gieben
2011-12-22 23:01 ` Miek Gieben
2011-12-22 23:42 ` Ray Andrews [this message]
2011-12-23 0:11 ` '$1' indexing Bart Schaefer
2011-12-23 2:08 ` Ray Andrews
2011-12-23 20:56 ` Bart Schaefer
2011-12-23 20:45 ` default to file completion Bart Schaefer
2011-12-25 10:32 ` Miek Gieben
2011-12-20 19:38 ` gi1242+zsh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EF3C07B.4040604@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).