[Linux-disciples] write to file from shell script

Adam Rosi-Kessel adam at rosi-kessel.org
Tue Nov 15 21:58:00 EST 2011


That should work.

But here are some ideas for troubleshooting.

Do you have a path issue? Are you running the script just from your home 
dir? What if you leave out the redirect, does the output from gondor 
sqldump go to screen? Try hard-coding the target filename with a full 
path (i.e., > /home/jforrest/test.sql).

On 11/15/2011 9:28 PM, Jamie Forrest wrote:
> What am I doing wrong? I am trying to write to a file from within a
> shell script, but the file doesn't get created. Here's the script:
>
> #!/bin/bash
>
> NOW=`date +%F`
> gondor sqldump primary>  $NOW_dump.sql
>
>
> (For what it's worth gondor sqldump is a command that dumps a remote
> database to sql (primary is the db instance). Generally when I run it
> from the cmd line I just run gondor sqldump primary>
> whatever_dump.sql and all is fine. I know this command is running ok
> because I see its output "Dumping database... [ok]" when I run the
> script.)
>
> Thanks,
> Jamie
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>



More information about the Linux-disciples mailing list