problems with PATTERN/LINE in ainsl(1)

Darshaka Pathirana dpat at syn-net.org
Wed Sep 30 02:40:49 CEST 2009


On 30.09.2009 02:32, Darshaka Pathirana wrote:
> Hi!
> 
> I have something like this:
> 
> <file>
> #! /bin/sh
> ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -[mp]"
> exit 0
> </file>
> 
> Got the expected output (in /etc/sudoers without LINE):
> 
>   %adm ALL = NOPASSWD: /bin/su -[mp]
> 
> Running again (now containing LINE) leads to:
> 
>   %adm ALL = NOPASSWD: /bin/su -[mp]
>   %adm ALL = NOPASSWD: /bin/su -[mp]
> 
> (I obviously exptected no adding..)
> 
> I then tried:
> 
> ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\[mp\]"

Oops. Forgot to take the shell into account:

ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\\[mp\\]"

This works like a charm but I wonder why I have to escape '[' and
']'? Did I miss something?

Greetings,
 - Darsha



More information about the linux-fai mailing list