[Linux-disciples] write to file from shell script

Stephen R Laniel steve at stevereads.com
Tue Nov 15 21:57:33 EST 2011


What happens if you just dump that output to stdout? Only dump the first few lines, à la

gondor sqldump primary | head

What happens then?

On Nov 15, 2011, at 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
> 

-- 
Stephen R. Laniel
steve at stevereads.com
Cell: +(617) 308-5571
http://stevereads.com/
PGP key: http://stevereads.com/slaniel.key



More information about the Linux-disciples mailing list