Timeline for Bash: psql command not found when called inside a function
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 18, 2023 at 23:32 | comment | added | Bash3d | @roaima Alright. But could you please help me understand why this particular function alone fails to recognize a properly expanded variable as a command, while the initial function can? And thanks for the responses.. I appreciate it.. | |
| Jan 18, 2023 at 23:00 | comment | added | Chris Davies | Then you need to tell the author of the master script that they are using functions and variables incorrectly. This is a common cause of unexpected errors | |
| Jan 18, 2023 at 22:41 | comment | added | Bash3d | @roaima I Agree, but unfortunately I cannot change the method. This variable in question is set in a master script that’s read only and we just source them in other scripts. Even if I were to use a function here in my script, I will have to use this variable, and that again yields the same result. | |
| Jan 18, 2023 at 22:03 | comment | added | Chris Davies | "I am able to run the command stored in a variable from first function" - it's an unreliable way of running a command. Use functions for commands and variables for data | |
| Jan 18, 2023 at 22:00 | history | edited | Chris Davies | CC BY-SA 4.0 | Format code as code with the {} button |
| Jan 18, 2023 at 21:58 | comment | added | Bash3d | @roaima sorry, that was a typo in question. I am using straight quotes in the actual code. Corrected it in question now. | |
| Jan 18, 2023 at 21:56 | history | edited | Bash3d | CC BY-SA 4.0 | deleted 1 character in body |
| Jan 18, 2023 at 21:28 | answer | added | Jim L. | timeline score: 0 | |
| Jan 18, 2023 at 21:22 | comment | added | Bash3d | @KamilMaciorowski Would you care to explain? I am able to run the command stored in a variable from first function. Only when I call it from a function within a function it fails. How is quotes/braces significant here? | |
| Jan 18, 2023 at 21:00 | history | edited | Bash3d | CC BY-SA 4.0 | deleted 100 characters in body |
| Jan 18, 2023 at 20:59 | comment | added | Kamil Maciorowski | How can we run a command stored in a variable? What are curly quotes and can I use them in my code? | |
| Jan 18, 2023 at 20:51 | history | edited | Bash3d | CC BY-SA 4.0 | added 80 characters in body |
| Jan 18, 2023 at 20:46 | history | edited | Bash3d | CC BY-SA 4.0 | edited body |
| S Jan 18, 2023 at 20:44 | review | First questions | |||
| Jan 19, 2023 at 6:50 | |||||
| S Jan 18, 2023 at 20:44 | history | asked | Bash3d | CC BY-SA 4.0 |