0

I have some simple shell scripts

#!/bin/bash

echo $(date)
NOW=$(date +%Y-%m-%d-%H-%M-%S)
NAME = "db.$NOW.sql"
echo $NAME
LOCALPATH = "/data/mysql/$NAME"
echo $LOCALPATH
/usr/bin/mysqldump -u username -ppassword --databases dbname > $LOCALPATH

Error message:

 line 5: NAME: command not found
 line 7: LOCALPATH: command not found

Something am I missing?

1 Answer 1

2

Dont use any whitespace when you are defining your variables.

NAME="db.$NOW.sql"

As you have it above, bash will try to execute something called NAME with arguments = and "db.$NOW.sql" respectively.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.