Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'don't use that shell script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
don't use that shell script
Authored by: lukec on Jul 23, '03 02:25:02AM

A few suggestions.

Renaming a file to $name.*** is a bad idea. Unless you've somehow explicitly disabled command substitution this will likely not work. Type echo * in that same directory and see what you get. That will be substituted for '*'.

You should also look at replacing your 'ls' command with 'find . -type f'. This will enable recursive functionality.

You probably don't want to strip your resource forks in place. So using tar in a situation like this would be nothing short of brilliant. Straight from any non-apple manpage for tar:

tar -cf - -C srcdir . | tar xpf - -C destdir

I know we're all eager to share what we know, but you should always test a shell script before you post it. Those who would use it, probably can't debug it.

Luke



[ Reply to This | # ]
don't use that shell script
Authored by: bluehz on Jul 23, '03 07:21:56AM

thx for the info lukec - I am definitely no pro when it comes to scripting. Always open to input from those more skilled than me. Heck 80% of everything I have learned scripting has been from here.



[ Reply to This | # ]
don't use that shell script
Authored by: bluehz on Jul 23, '03 08:26:42AM

... also - I CHECK every script, hint, etc, I post - usually several times, and on more than one machine. The above script was tested, several times and performed acceptably for the purposes it was intended. It may not bethe best scripting in the world, BUT it does work, and I have had no problems with it.

...nevertheless thx



[ Reply to This | # ]