[NTLUG:Discuss] How to get mv to not report when there are no files?
Daniel Hauck
daniel at yacg.com
Sat Nov 10 21:38:41 CST 2007
Wayne Walker wrote:
> On Tue, Nov 06, 2007 at 04:16:18PM -0800, Rick Renshaw wrote:
>> --- Neil Aggarwal <neil at JAMMConsulting.com> wrote:
>> Easiest way would be
>> mv /home/johnc/* /var/www/html/incoming > /dev/null
>
> That will still generate output (error messages go to file descriptor 2,
> aka stderror)
>
> mv /home/johnc/* /var/www/html/incoming 2> /dev/null
>
> will work, BUT will fail to notify you if something goes wrong.
>
Well, there's always the option of writing the function of "mv" by using
some clever shell scripting that checks for the existence of whatever
then does a mv or a cp + rm.
And if you wanna get fancy, modify the source of mv and suppress the
messages you don't want to see and compile it as
"mv_suppressed_messages_I_dont_want_to_see"?
More information about the Discuss
mailing list