0

I am trying to run a bash script and set the variables in one command. Is this possible?

bash wp.sh dbname="hello",dbuser="admin"

It's not working for me, and I can't seem to find any guidance on this. Thanks in advance for your help!

1

1 Answer 1

2

To set environment variables that will be inherited by the script process, put the assignments at the beginning:

dbname="hello" dbuser="admin" bash wp.sh
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much! That did it. As soon as it lets me mark this as the correct answer (in ~10 minutes), I will. Much appreciated! :)
Your other option is to process the values as command line arguments, but that would take modifying the script to properly accept them. Sometimes is just the simple things that help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.