Hello, I am having an issue with a BASH shell.
I assign a variable with this code:
SERVICE_ID_EXISTS=$($PSQL “SELECT name FROM services WHERE service_id = $SERVICE_ID_WANTED”)
Output Looks like this, and it should read testTrim:
test Trim
If I print this, it has a leading white space, and as such I cannot test in an if [[ -z ]].
Why is bash attaching a leading whitespace and how do I fix it?
Thank you! When I test the length of the variable pulled from the SQL query, it shows the proper length, it happens only AFTER assigned to the bash variable. Have you seen that before?
my experience with bash is limited so I cannot say yes or no and have it mean anything worth your time.
Why don’t you double check the value in the table by going through the actual terminal to the database (connect to it) and running the select there? I just want you to be sure, really sure, it isn’t coming from the table data itself.