Re: How do create a user with a bashscript

Поиск
Список
Период
Сортировка
Искать
От
A B
Тема
Re: How do create a user with a bashscript
Дата
Msg-id
dbbf25900809190302q67ad0a65w9d966fa0bcac51a6@mail.gmail.com
Ответ на
Список
Дерево обсуждения
How do create a user with a bashscript "A B" <gentosaker@gmail.com>
Re: How do create a user with a bashscript Devrim GÜNDÜZ <devrim@gunduz.org>
Re: How do create a user with a bashscript Andreas Kretschmer <akretschmer@spamfence.net>
Re: How do create a user with a bashscript "A B" <gentosaker@gmail.com>
2008/9/19 Andreas Kretschmer :
> A B  schrieb:
>
>> Hi.
>> I want to create a user with the  createuser  command and supply the
>> password at the command line in a script, like this
>>
>> #!/bin/bash
>> createuser  myuser
>>
>> but I want to supply a password on the command line, is that possible?
>> The docs tells me no, but does anyone know of a workaround?
>
> Maybe with expect(1):
>
> NAME
>       expect - programmed dialogue with interactive programs, Version 5
>
> SYNOPSIS
>       expect [ -dDinN ] [ -c cmds ] [ [ -[f|b] ] cmdfile ] [ args ]
>
> INTRODUCTION
>       Expect  is  a program that "talks" to other interactive programs according to a script.  Following the script, Expect knows what can be expected
>       from a program and what the correct response should be.  An interpreted language provides branching and high-level control structures to  direct
>       the dialogue.  In addition, the user can take control and interact directly when desired, afterward returning control to the script.
>
>
>
> Andreas

I managed to do it by calling psql and setting the password in the
command (with -c option). Took some time to figure out that I had to
use the template1 database when connecting.
В списке pgsql-novice по дате отправления
От: Andreas Kretschmer
Дата:
От: Howard Eglowstein
Дата:
FAQ