lists.arthurdejong.org
RSS feed

Re: Using the initial letter in the home directory

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: Using the initial letter in the home directory



Arthur de Jong wrote:
> On Tue, 2016-05-24 at 21:46 +0200, Jakub Jindra wrote:
> > Acording to manpage of nslcd.conf and "Attribute mapping expressions"
> > and bash manpage "${parameter:offset:length}"
> > I think that following example should work:
> > map     passwd  homeDirectory  
> > "/home/${sAMAccountName:0:1}/${sAMAccountName}"
>
> Sadly it does not. nslcd only supports a very small subset of the ${}
> syntax but patches are welcome.
>
> This shouldn't be too difficult to implement. The code is in
> common/expr.c in the parse_dollar_expression() function. I just pushed
> a change that would make extending the parsing slightly easier.

Nitpick: note that ${parameter:offset:length} is a bashism;
it is absent from SUS sh (as at 2013 release):

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

Also:

    bash4$ dpkg-query -W dash
    dash    0.5.7-4+b1
    bash4$ dash
    $ x=foo
    $ echo "${x:2}"
    dash: 2: Bad substitution
-- 
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users/