help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Script Not Working


From: Dennis Williamson
Subject: Re: [Help-bash] Script Not Working
Date: Fri, 14 Nov 2014 17:57:33 -0600

On Fri, Nov 14, 2014 at 1:41 PM, nick <address@hidden> wrote:

> So close it also works this is the output.
>
> Execution of 'oldfiles2 testdir':
>
>
> Files in 'testdir' after 'oldfiles2' was run:
> file1.old  file2.old  file3old.old  file4.old
>
> Error: 'for' does not seem to loop only through required filenames
>
> On 14-11-14 02:38 PM, Dennis Williamson wrote:
> > for file in "$1"/*
> > do
> >   if [[ $file != *.old ]]
> >   then
> >     mv -- "$file" "$file.old"
> >   fi
> > done
>

That looks like it worked to me.

file1  file2.old  file3old  file4

became

file1.old  file2.old  file3old.old  file4.old

How is that incorrect?

-- 
Visit serverfault.com to get your system administration questions answered.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]