[Linux-disciples] write to file from shell script

Jamie Forrest jamie at jamieforrest.com
Tue Nov 15 22:01:25 EST 2011


On Tue, Nov 15, 2011 at 9:58 PM, Adam Rosi-Kessel <adam at rosi-kessel.org> wrote:
> 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).

I'm running it from a subdirectory in my home dir. I tried changing it
to a full path and still no dice. And yes the output from gondor
sqldump goes to screen normally.

>
> 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
>>
>
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>



-- 
http://about.me/jamieforrest


More information about the Linux-disciples mailing list