From: Janet on
My script creates the directory named after the current month that I
extract from the date but I get
an error message.

Any help would be greately appreciated.

Janet Heath
_________________________________________________________________________________
# /usr/bin/move_mereports

# move month-end reports to an archive folder to save them



# CREATE MONTHLY DIRECTORY

set mon=`date +%B`

mkdir /spool/mearchives/clas/$mon



# MOVE FILES TO /SPOOL/TNI/RETL/MEARCHIVES ON THE 10TH OF EVERY MONTH

find /spool/tni/clas -type file -a -name "*" -print|xargs -i -t cp {}
/spool/mea
rchives/clas/$mon >> /tmp/clean_mereports.log 2>&1


__________________________________________________________________________________

Error message:

Ambiguous output redirect

From: Bill Marcum on
On 8 Nov 2006 15:01:24 -0800, Janet
<jowens(a)wehco.com> wrote:
> My script creates the directory named after the current month that I
> extract from the date but I get
> an error message.
>
> Any help would be greately appreciated.
>
Your script is written in csh, but csh does not use "2>&1".
In the last line, change
>> /tmp/clean_mereports.log 2>&1
to
>>& /tmp/clean_mereports.log

Or rewrite the script in sh, bash or ksh.

--
People are unconditionally guaranteed to be full of defects.
From: Chris F.A. Johnson on
On 2006-11-08, Janet wrote:
> My script creates the directory named after the current month that I
> extract from the date but I get
> an error message.
>
> Any help would be greately appreciated.
>
> Janet Heath
> _________________________________________________________________________________
> # /usr/bin/move_mereports
>
> # move month-end reports to an archive folder to save them
>
>
>
> # CREATE MONTHLY DIRECTORY
>
> set mon=`date +%B`

Don't write scripts in csh. See:

<http://www.grymoire.com/Unix/CshTop10.txt>
<http://www.grymoire.com/Unix/Csh.html#uh-0>
<http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/>

> mkdir /spool/mearchives/clas/$mon
>
>
>
> # MOVE FILES TO /SPOOL/TNI/RETL/MEARCHIVES ON THE 10TH OF EVERY MONTH
>
> find /spool/tni/clas -type file -a -name "*" -print|xargs -i -t cp {}
> /spool/mea
> rchives/clas/$mon >> /tmp/clean_mereports.log 2>&1
>
>
> __________________________________________________________________________________
>
> Error message:
>
> Ambiguous output redirect

#! /bin/sh

mon=`date +%B`
mkdir /spool/mearchives/clas/$mon &&
find /spool/tni/clas -type file -a -name "*" -print |
xargs -i -t cp {} /spool/mearchives/clas/$mon >> /tmp/clean_mereports.log 2>&1

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
From: Janet on

Chris F.A. Johnson wrote:
> On 2006-11-08, Janet wrote:
> > My script creates the directory named after the current month that I
> > extract from the date but I get
> > an error message.
> >
> > Any help would be greately appreciated.
> >
> > Janet Heath
> > _________________________________________________________________________________
> > # /usr/bin/move_mereports
> >
> > # move month-end reports to an archive folder to save them
> >
> >
> >
> > # CREATE MONTHLY DIRECTORY
> >
> > set mon=`date +%B`
>
> Don't write scripts in csh. See:
>
> <http://www.grymoire.com/Unix/CshTop10.txt>
> <http://www.grymoire.com/Unix/Csh.html#uh-0>
> <http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/>
>
> > mkdir /spool/mearchives/clas/$mon
> >
> >
> >
> > # MOVE FILES TO /SPOOL/TNI/RETL/MEARCHIVES ON THE 10TH OF EVERY MONTH
> >
> > find /spool/tni/clas -type file -a -name "*" -print|xargs -i -t cp {}
> > /spool/mea
> > rchives/clas/$mon >> /tmp/clean_mereports.log 2>&1
> >
> >
> > __________________________________________________________________________________
> >
> > Error message:
> >
> > Ambiguous output redirect
>
> #! /bin/sh
>
> mon=`date +%B`
> mkdir /spool/mearchives/clas/$mon &&
> find /spool/tni/clas -type file -a -name "*" -print |
> xargs -i -t cp {} /spool/mearchives/clas/$mon >> /tmp/clean_mereports.log 2>&1
>
> --
> Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> ===== My code in this post, if any, assumes the POSIX locale
> ===== and is released under the GNU General Public Licence

Thank you guys for your help. I understand what you are saying. It is
not my choice to pick shells to write my scripts in. This is for my
employer and that is what they do their scripts in.

Janet

From: Janet on

Janet wrote:
> Chris F.A. Johnson wrote:
> > On 2006-11-08, Janet wrote:
> > > My script creates the directory named after the current month that I
> > > extract from the date but I get
> > > an error message.
> > >
> > > Any help would be greately appreciated.
> > >
> > > Janet Heath
> > > _________________________________________________________________________________
> > > # /usr/bin/move_mereports
> > >
> > > # move month-end reports to an archive folder to save them
> > >
> > >
> > >
> > > # CREATE MONTHLY DIRECTORY
> > >
> > > set mon=`date +%B`
> >
> > Don't write scripts in csh. See:
> >
> > <http://www.grymoire.com/Unix/CshTop10.txt>
> > <http://www.grymoire.com/Unix/Csh.html#uh-0>
> > <http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/>
> >
> > > mkdir /spool/mearchives/clas/$mon
> > >
> > >
> > >
> > > # MOVE FILES TO /SPOOL/TNI/RETL/MEARCHIVES ON THE 10TH OF EVERY MONTH
> > >
> > > find /spool/tni/clas -type file -a -name "*" -print|xargs -i -t cp {}
> > > /spool/mea
> > > rchives/clas/$mon >> /tmp/clean_mereports.log 2>&1
> > >
> > >
> > > __________________________________________________________________________________
> > >
> > > Error message:
> > >
> > > Ambiguous output redirect
> >
> > #! /bin/sh
> >
> > mon=`date +%B`
> > mkdir /spool/mearchives/clas/$mon &&
> > find /spool/tni/clas -type file -a -name "*" -print |
> > xargs -i -t cp {} /spool/mearchives/clas/$mon >> /tmp/clean_mereports.log 2>&1
> >
> > --
> > Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
> > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> > ===== My code in this post, if any, assumes the POSIX locale
> > ===== and is released under the GNU General Public Licence
>
> Thank you guys for your help. I understand what you are saying. It is
> not my choice to pick shells to write my scripts in. This is for my
> employer and that is what they do their scripts in.
>
> Janet

My script works perfect now! Yeah!!!! Appreciate you guys!!! I am
not real familiar with scripts. I take what we already have make
something work although not always can I do that. I don't do script
programming on a regular basis so I don't have a need to get in depth
with it. Anyway my script does everything that I want it to do and no
error messages. Thank you so much guys!!!

Janet

 | 
Pages: 1
Prev: "at" commond
Next: bc vs calc (was bc precision)