# innobackupex command runs from command-line but not from bash script

**URL:** <https://forums.percona.com/t/innobackupex-command-runs-from-command-line-but-not-from-bash-script/2826>\
**Category:** Percona XtraBackup\
**Created:** [July 17, 2013, 3:09pm UTC](https://forums.percona.com/t/innobackupex-command-runs-from-command-line-but-not-from-bash-script/2826 "2013-07-17T15:09:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![computrav](https://avatars.discourse-cdn.com/v4/letter/c/c4cdca/32.png) [@computrav](https://forums.percona.com/u/computrav)\
**Post date:** [July 17, 2013, 3:09pm UTC](https://forums.percona.com/t/innobackupex-command-runs-from-command-line-but-not-from-bash-script/2826/1 "2013-07-17T15:09:05Z")

</div>

I’ve got a bash script that I’ve created to run a backup using innobackupex/xtrabackup, but I’m having an issue actually executing the innobackupex command from the script.

Here is a simplied version of my script highlighting the issue (test.bash):

```auto

=======================================
#!/bin/bash

CMD="/usr/bin/innobackupex --user=username --password=password /var/backups/mysql/test &> /var/backups/mysql/test.log"
`$CMD`
=======================================

```

All this is doing is storing the command I want to execute to a variable and then executing it. In my actual script, the command is constructed from other options and settings, but even this simple script fails. The command itself is running the backup, and storing the output in test.log, and running the command in the background

When I try to run this script (e.g., bash test.bash), I get the error:  
innobackupex: Too many command line arguments

However, if I literally copy the command above and then paste into the console at a bash prompt, it runs fine.

Anyone have any idea what’s going on here?

Thanks,  
Travis

---

<div class="post-metadata">

**Author:** ![laudares](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/laudares/32/10_2.png) [@laudares](https://forums.percona.com/u/laudares)\
**Post date:** [July 17, 2013, 3:43pm UTC](https://forums.percona.com/t/innobackupex-command-runs-from-command-line-but-not-from-bash-script/2826/2 "2013-07-17T15:43:23Z")

</div>

Hi Travis,

you’re facing a bash syntax problem - here’s a turnaround by indicating the output separated from the innobackupex command itself:

CMD=“/usr/bin/innobackupex --user=username --password=password /var/backups/mysql/test”

$CMD &\> /var/backups/mysql/test.log

That should do. Let us known, please.

Regards,

Fernando

---

<div class="post-metadata">

**Author:** ![computrav](https://avatars.discourse-cdn.com/v4/letter/c/c4cdca/32.png) [@computrav](https://forums.percona.com/u/computrav)\
**Post date:** [July 17, 2013, 3:46pm UTC](https://forums.percona.com/t/innobackupex-command-runs-from-command-line-but-not-from-bash-script/2826/3 "2013-07-17T15:46:02Z")

</div>

Thanks Fernando, that did the trick!!

-Travis
