Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9q6K-00CTbq-15 for pgsql-general@arkaria.postgresql.org; Sat, 09 Nov 2024 18:22:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t9q6G-003PBH-Rh for pgsql-general@arkaria.postgresql.org; Sat, 09 Nov 2024 18:22:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9q6G-003PB9-Gy for pgsql-general@lists.postgresql.org; Sat, 09 Nov 2024 18:22:21 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9q6D-0010Uq-RR for pgsql-general@lists.postgresql.org; Sat, 09 Nov 2024 18:22:19 +0000 Received: by mail-wr1-x443.google.com with SMTP id ffacd0b85a97d-37d6ff1cbe1so2399618f8f.3 for ; Sat, 09 Nov 2024 10:22:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731176535; x=1731781335; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8K9V3WwF1MBVSICGfV2e97FffMpB8w7lx4RmA9DITcE=; b=DZe3t8/lbbzrgiVDPr2hccYFEZBJW8MB7R76XORnA11vVr7D0VSxUlm4GYhv/236kI lfJt4+LAvXZVS9dQaXztDzX0xTKwlyra92gXDbX9hnHwJwQvpKeEc80/jYH8Ru9qvgTM kZzt+jylNL/5ITbcj+46dkSVvS53pRRtzrSmjtFpYm1jKUahceqIvnePaw+kD3QkrvF+ IgxX9TfpPaPY8EqXfJ8WAuVPd6nuMugE+s8Qkctd+NhnZRhGdtCTY+7EJSQZFOvoVOm/ QI3+HwF/k5T+WtNNkFc0k2BjDmyvCuSDR8xeHJwunt2UxmLIPw7qxgZYwQz0iJzs/Yyp kWpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731176535; x=1731781335; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8K9V3WwF1MBVSICGfV2e97FffMpB8w7lx4RmA9DITcE=; b=D+lpEQNG0FtWkl/2lybM4yAtDcNily4hajq5k1teJU8GQaT2RsCypTFtTQeTyvPe20 mvhfWg/nE7Y+H41Qyg3jknI0hZGABhys1dcqWiyIUeS1vGUlCKMYKY7JdjBWXSYhlAFR 6g9lkyQrzZWAoHnL9revZgM22Vzi74JIrhd5/7+aGr24cXmmDyyW/Ja+ElV4wavfYTa2 FW+DhQahABVeHa01tpY+IXC+34lLciQPwxA9vxlfJ6GzRE0PEtC7pQgCK0X3OHY1i+Hi 1XuPIe/a+S5BW0U0T683YqFPIIqxP3ZQEPujX6Jkjbet3h6kMVeumJVyA+zE6C3YmT5S /zeg== X-Gm-Message-State: AOJu0YwPEspxw5F7w4IEl0bDZrs3iOcxBZXfW+2YA1NZ+PBmgGST3R1E LS+VtZSKjslgfW7wA/Vqptb9Z/7hkGeSB2920S2t3gvLvD++5B6VRVVNHFfvdEmLpri8VYk1oFv gIEXyOnViMcG1GdDS/7X22vosQKk= X-Google-Smtp-Source: AGHT+IFSMU/WdyOvYz742WviGfbTxvgXQXlTNyZFYPix/YhQOcfQzb03nIyHq2UDCGRMs3K0l2Qt2LyBlBiN2GDWYIk= X-Received: by 2002:a5d:47a7:0:b0:37d:5173:7a54 with SMTP id ffacd0b85a97d-381f1835600mr6370466f8f.52.1731176535287; Sat, 09 Nov 2024 10:22:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Vijaykumar Jain Date: Sat, 9 Nov 2024 23:52:04 +0530 Message-ID: Subject: Re: Bash function from psql (v14) To: Murthy Nunna Cc: "pgsql-general@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 9 Nov 2024 at 23:11, Murthy Nunna wrote: > I am trying to code bash function and call it from psql. But it is failin= g. How can I get this to work. Creating a separate script instead of a func= tion works, but I do not want to do that. I have too many variables to be p= assed back and forth. Any ideas? > Run the above script: > > ./test-bash-function.sh > > sh: line 1: run-bash-function: command not found > > in bash function > > /* postgres@ubuntu:/tmp$ echo 'whoami' >> myscript.sh postgres@ubuntu:/tmp$ chmod a+x myscript.sh postgres@ubuntu:/tmp$ psql <