Thanks for the responses

This feature already exist
> https://github.com/apache/nuttx-apps/blob/master/nshlib/Kconfig#L126-L146
>

As far as I can understand, that is for backquotes `foo` which is a type of
variable expansion. What I need is support for single quotes 'foo' which
means that whatever is inside '' is just a string litral. Or do you mean
that the variable expansion support is already there ?

Does posix say something about shells?
>

Yes POSIX demands that the aliases are stored per session only.

BR, Ville Juven

>
On Thu, Mar 9, 2023 at 12:35 PM Xiang Xiao <xiaoxiang781...@gmail.com>
wrote:

> On Thu, Mar 9, 2023 at 6:14 PM Ville Juven <ville.ju...@gmail.com> wrote:
>
> > Hi all,
> >
> > I'm in the process of writing support for shell aliases into NSH, but
> since
> > the shell is the front end for NuttX I decided to make a post here for
> > opinions on this matter and to open discussion for requirements, mostly
> to
> > prevent unexpected regression issues that might arise from this.
> >
> > 1. Are shell aliases seen as something useful in the community ? I need
> > them for a project of mine which is the reason I started implementing
> > support but I'd like to know if they are seen as useful whatsoever by
> > others.
> >
> > 2. To properly support aliases, the shell parser needs to support single
> > quotes and double quotes. This support will generate a bit of extra code
> > into the parser, is this seen as OK ?
> >
> > alias foo='bar baz'
> > alias foo="bar $baz"
> >
> > In both cases, the parser stops on the first delimiter (whitespace) even
> > though it is quoted.
> >
> > 3. I will implement support for *single quotes* as this is a simple case
> > but not for double quotes as the rules are more complex (need to perform
> > variable expansions etc). Is this seen as a blocker / fatal issue?
> >
> >
> This feature already exist
> https://github.com/apache/nuttx-apps/blob/master/nshlib/Kconfig#L126-L146
>
>
> > 4. I added a Kconfig option to turn alias support on/off, what should the
> > default state of this option be ? Currently it is defined as follows:
> >
> > config NSH_ALIAS
> >     bool "Enable alias support"
> >     default !DEFAULT_SMALL
> >
> > I noticed that many of the shell features are flagged behind
> DEFAULT_SMALL.
> >
> > Also the alias amount is configurable.
> >
> > 5. Currently aliases are implemented globally i.e. every shell shares the
> > same aliases, is this seen as a problem or should I make the aliases
> stick
> > to a shell session only ?
> >
> >
>  It's better to follow the POSIX spec.
>
> This is my first time posting on this board, so apologies if I did
> > something improper.
> >
> > Br, Ville Juven
> >
>

Reply via email to