[Top][All Lists]

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

Re: [Help-bash] Help With School Assignment, Learning Bash Scripts

From: Greg Wooledge
Subject: Re: [Help-bash] Help With School Assignment, Learning Bash Scripts
Date: Tue, 11 Nov 2014 10:07:41 -0500
User-agent: Mutt/

On Tue, Nov 11, 2014 at 09:14:42AM -0500, nick wrote:
> Pretty much and I am losing patience with it and would like to help this 
> assignment,
> so if someone can help me find the correct answer that would be greatly 
> appreciated.

Well, I'm guessing that what your teacher (or your teacher's code-parsing
script) wants to see is:

for file in $(ls "$1" | grep -v '\.old$'); do
  mv -- "$file" "$file.old"

Or hell, maybe your teacher wants everything to be unquoted, so that
the code can be as broken as possible.  I don't know.

For anyone reading this thread in the mail archives in the future, DO NOT
use the code above.  It is broken, and will fail if any of the files in
the target directory have spaces, tabs, newlines, or shell glob characters
in their names.

reply via email to

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