All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof.johansson@axis.com>
To: Isak Lichtenstein <Isak.Lichtenstein@kistler.com>
Cc: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: Bash parser
Date: Wed, 16 Jul 2014 11:53:30 +0200	[thread overview]
Message-ID: <20140716095330.GC23194@axis.com> (raw)
In-Reply-To: <91B4C1B91AAEFD42AC985EA0F3D4E66886164946@kihagwinex01.int.kistler.com>

On 14-07-16 11:36 +0200, Isak Lichtenstein wrote:
> In this method I'm using the bash syntax. But a lot of time the
> parser doesn't manage to parse my file properly. Examples:
> 
> 	TMP="file1 file2"
> 	read -a scripts <<< $tmp
> generates
> 	ShellSyntaxError: expecting here-document name, got '<'
> 
> Or 
> 
> 	TMP="file1 file2"
> 	scripts=(${TMP})
> generate
> 	ShellSyntaxError: LexToken(TOKEN,'${TMP}',0,0)
> 
> 
> Other bash commands are parsed properly, but generate an error
> while executing them. Example:
> 	TMP="file1, file2"
> 	tmp=${TMP//,/ }
> generates
> 	Bad substitution
> 	| WARNING: exit code 2 from a shell command.

Note that these features you describe here are all bash
extensions. For Debian users (and I think Ubuntu users as well?),
the default /bin/sh is dash and does not support either of these
extensions. There are cases where the bitbake parser will refuse
valid portable shell script features as well though, like shell
arithmetics, e.g.:

 n=$((n+1))

> Does a page exist somewhere describing the bash features
> supported by the parser and also the execution environment?
> Are arrays supported at all?

I don't know of any such documentation, but if you stick to
portable shell script features, you should be mostly fine.

-- 
olofjn


  reply	other threads:[~2014-07-16 10:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  9:36 Bash parser Isak Lichtenstein
2014-07-16  9:53 ` Olof Johansson [this message]
2014-07-16 10:32   ` Isak Lichtenstein
2014-07-16 16:14     ` William Mills
2014-07-21 11:32   ` Paul Eggleton

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=20140716095330.GC23194@axis.com \
    --to=olof.johansson@axis.com \
    --cc=Isak.Lichtenstein@kistler.com \
    --cc=yocto@yoctoproject.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.