Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For backup MySQL MyISAM database, I'm using:

backupdb=siteone
mysqldump -u root -pthepass --lock-tables --add-locks --disable-keys --skip-extended-insert --quick $backupdb > /var/www/html/db2.sql

Even after long time using it, I still dont know what is the name of using nameofmychoice=anyname.

After typing backupdb=siteone I need to know how long it will kept in memory? If I running many lines of command which takes very long time, do I need to type backupdb=siteone again and again from time to time to regenerate the alias?

Is using this way really safe for almost anything? I'm worried of data loss since I'm dealing with database.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

In your example, backupdb is called a variable. A shell variable will be there until you change it to a new value, or the shell exits (most likely because you type exit, or close the terminal). In your case, backupdb will be there for a long time, so you don't need to type that again and again.

My guess is that you are using the BASH shell because it's quite popular. If you want to find out more you can read the BASH programming intro.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.