[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/1.4.2.3i |
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"
done
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.
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, (continued)
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Greg Wooledge, 2014/11/06
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, nick, 2014/11/06
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Eduardo A . Bustamante López, 2014/11/06
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, nick, 2014/11/06
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Greg Wooledge, 2014/11/07
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Eric Blake, 2014/11/07
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Greg Wooledge, 2014/11/07
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, nick, 2014/11/07
- Message not available
- Message not available
- Message not available
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Greg Wooledge, 2014/11/11
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, nick, 2014/11/11
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts,
Greg Wooledge <=
- Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, nick, 2014/11/06
Re: [Help-bash] Help With School Assignment, Learning Bash Scripts, Jesse Molina, 2014/11/05