From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7772 invoked by alias); 3 Feb 2015 23:42:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19801 Received: (qmail 15238 invoked from network); 3 Feb 2015 23:42:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_HDRS_LCASE,T_MANY_HDRS_LCASE autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=X+5rdgje c=1 sm=1 tr=0 a=f7zwPcoQMel2pEJwRS33iw==:117 a=f7zwPcoQMel2pEJwRS33iw==:17 a=Hpgzp-inWqAA:10 a=IkcTkHD0fZMA:10 a=PRUdlxXTuLvrPElfgOoA:9 a=QEXdDO2ut3YA:10 Message-id: <54D155C8.4080600@eastlink.ca> Date: Tue, 03 Feb 2015 15:12:08 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-version: 1.0 To: Zsh Users Subject: ${var:1:1:=y} Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit We can of course do this: variable=${var:=xy} I'm wanting the naive expansion of that syntax to do this: variable=${var:1:1:=y} ... but it doesn't work. Can something like that be done? At the moment I'm doing this: variable=${var:1:1} [ -n "$variable" ] || variable=y ... which is perfectly fine, but the above pseudosyntax would be elegant if it could be made workable. And I found something that puzzles me: test () { echo $1 echo ${1:0:1} /bin/echo ${1:0:1} echo ${1:1:1} echo ${1:0:1}${1:1:1} echo ${1:1:1}${1:0:1} } $ test -a -a [nothing] - a -a a- ... If I entered a valid switchofcourse I'd expect that to be eaten but a solitary dash? Bug? /bin/echo behaves as I'd expect.