Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egvxI-0004hL-6L for pgsql-general@arkaria.postgresql.org; Wed, 31 Jan 2018 17:13:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egvxH-0000oh-0y for pgsql-general@arkaria.postgresql.org; Wed, 31 Jan 2018 17:13:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egvxG-0000oX-ML; Wed, 31 Jan 2018 17:13:50 +0000 Received: from mout.gmx.net ([212.227.15.18]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egvxB-0007hD-7t; Wed, 31 Jan 2018 17:13:49 +0000 Received: from hermes ([80.139.216.133]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MWBpJ-1eDvky3J17-00XNTp; Wed, 31 Jan 2018 18:13:42 +0100 Received: from ncq by hermes with local (Exim 4.90) (envelope-from ) id 1egvx6-0000KA-Jm; Wed, 31 Jan 2018 18:13:40 +0100 Date: Wed, 31 Jan 2018 18:13:40 +0100 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org, pgsql-general Subject: Re: Equivalent shell script of create user and schema in specific postgres db Message-ID: <20180131171340.GB1998@hermes.hilbert.loc> Mail-Followup-To: pgsql-general@lists.postgresql.org, pgsql-general References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.9.2 (2017-12-15) Sender: X-Provags-ID: V03:K0:cgm3lrIOZRvNwfUEUAAyIPq/JiDvHGMDjP8qfJ6ZWRGgm98v1qs 3U7fKTzaFDiQKzavWR5fK61nGej1bDbqaWnLeMX2z5I8c96qwsTnwRtvznKmmNXlrkDqBHT RyKcQ5Q29Ds1NQ5SxUYvP364Y7l1Uez0HReerutpPrg3Z15A7RpcWmbyuw+mZXvz6AnozUe dj6KO8DYrf1p+Dfq86MAw== X-UI-Out-Filterresults: notjunk:1;V01:K0:qfGqyK+kdVA=:QmCHGW5a4AXb3hpSqA/pAh bsufxMghqIFRhvXWC1PsycWgMFMwNvIp7y52B+mhLzaCKW3NYYFtqgoVsWCGH273BRmReBPBG 6OTNqeF51new2ODcVh5L5reacPVPEXmIHMlrXV5gzBSbuh0f5rYqhN9q5cd/CCCQ9Womsvt1z mnUXotnPI+ISUgu5AQDIfLSmdAJqw4yfndMNF2QyfzPNLUCLvakxj3n/QhwdguMZPMTskiWk6 WiafK0zA6Zn8xMM21YngWMQFdwnt4JDQ+ZdB6PV6P72NpQpxIyiRWHrKHGhk40Rx/Iv8Gfdnp fUMihtnRpn2R+9kVV3YTKjoA86P8KQlK+mevquioC2MCYw9+zIggCu6sV6bEKCdobB0IbYSl8 7BMAg/xUAhMoPOcE98XKIUr05RrSICcXwbFiEB9MLawuYW/gh0GzxNxGiX32pnXZLt6RtgU0B YEW0lpqZRFfQOPDFR0YVZI0MnJqtWJmPW+7pWjTcr+ilzF5rh1ZqjbBlX+Y5nAfujqx5SNG2X R8NFhssUwvTNY7JzmyMarVfXweeRS3Ex9NylIXG2zcypmD/fogsRMiy0Fp1f58PthkGvVSOnx ZEvBYvT0BkEnnPuf6XXji8jhSXS5qIQPSKC3PdJA+RqwdkXdjYnoCRZXNyvPSIYRbzg55UDan DRNeL1cSoL0sjQMhTzJwP++34BaPDrbo3IXd/jcnLWrv85AywXTjnRhpLFeMzL1T7S/Kh2V3I cr8Sq5AZqFYgpUWRbbet0sUhCTb9qvpjjJrqHoR1s4j/Jfi8Qn86pwDtsZhOfgjHVdlUnQa89 BFysa8pmhnBjhOi+BszlFLGK/qpCw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jan 31, 2018 at 10:27:53PM +0530, Abhra Kar wrote: > Create a user and schema of same name with in ‘abc’ db through linux shell – > > > > Psql steps--- > > > > 1> [/home]# su postgres > > 2> bash-4.1$ psql > > 3> postgres=# \c abc [ set database abc] > > 4> abc=# create user abhra with password ‘1234’ > > 5> abc=# alter user abhra with superuser > > 6> abc=# create schema authorization with abhra; > > > I need to create a xyz.sh file which will do the same thing and username > and password pass as argument. Like in a configuration file it will be > mentioned and in xyz.sh file will be access as $1 , $2 > > > What should be the equivalent shell script? This rather sounds like a homework assignment. What have you tried so far ? Regards, Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346