From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 4226 invoked from network); 22 Apr 2020 16:44:51 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 22 Apr 2020 16:44:51 -0000 Received: (qmail 742 invoked by alias); 22 Apr 2020 16:44:41 -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: List-Unsubscribe: X-Seq: 24800 Received: (qmail 2630 invoked by uid 1010); 22 Apr 2020 16:44:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25786. spamassassin: 3.4.4. Clear:RC:0(209.85.166.41):SA:0(-2.0/5.0):. Processed in 4.165185 secs); 22 Apr 2020 16:44:41 -0000 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.41 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5D7Q1THOtP5RiWQIlgABBsgSqB/ktrLamlPGeGmb4JA=; b=jKWeXb4zOEum2lMiJx9njoNeDPtm9qqpnIKMoWDxNIQDzFAg/c+mUfcx6I5PNF4IGV Gzako/G8+mcrkf5CV1CyLu4iv7a++ftNAYomCnUenDSmP24cTiEAtCcTYEgJjYcwqwSX Yq950br9A+axGMJJPReA1CPUIcu2kYebpk18mL6ha2uFJKvyYaCHOZs3rw31x+ziZaqF +uSrq58eLdY8wTM9q4f6qsbkUW2ZqaGbB0u8cEa+m6Kd3f9Me8F70vGuX1TQMWxhgZsR AKEuq79xfQhYTFRTvJx3e/4TUsdz+uDjOqd6xUoy6plHGlexiwDMdXRyZ7Ig1RfzZmkV Q2TA== X-Gm-Message-State: AGi0PuYpcPSwXXc5CaxOxRqmafbE8BvDdteyXcbH6MtsEtrE2dlTH6oB xUYsqhgO+vhcA2i+WS2S5sVrAWUBpvg/iw3NP4xvzzdo X-Google-Smtp-Source: APiQypLvkIBcik0xuWRi/i+WFcCyGFTBiZXiUT5FLkjt7Vo2rZiUYfqEVluiPFF/abSuFXLAQmJWYj9orRgKJi8EgMQ= X-Received: by 2002:a5d:9698:: with SMTP id m24mr26457052ion.143.1587573842651; Wed, 22 Apr 2020 09:44:02 -0700 (PDT) MIME-Version: 1.0 From: Pier Paolo Grassi Date: Wed, 22 Apr 2020 18:43:25 +0200 Message-ID: Subject: field splitting To: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000f255ca05a3e3d6e4" --000000000000f255ca05a3e3d6e4 Content-Type: text/plain; charset="UTF-8" I am trying to use field splitting to get the first word of a line. I am using: echo -n ${${(s: :)line}[1]} when input contains spaces I get the first word as needed, eg: line is: /usr/bin/python - /usr/bin/python /usr/local/bin/terminator what is printed: /usr/bin/python when input does not contains spaces, however, all I get is the first character of the line, eg: line is: /usr/bin/zsh what is printed: / I have trid forcing the array expansion in various ways: ${${(@s: :)line}[1]} ${${(s: :)line[@]}[1]} ${"${(s: :)line[@]}"[1]} but I couldn't get the desidered behaviour what am I missing? Pier Paolo Grassi linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217 founder: https://www.meetup.com/it-IT/Machine-Learning-TO --000000000000f255ca05a3e3d6e4--