HELP! Scripting newbie question.
- From: Julie Warden <julie_warden@xxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 18:59:41 GMT
Group,
I'm trying to write a script to process a file list for an argument
passed in. It seems like it should be real easy, but it's not getting
expanded. I just get the 1st file and that's it.
I use Bourne or Korn shell. I included a few examples so you know I've
been RTFM'ing a bit - eval should have done it according to the scripting
book I've got. If I hard code the argument it works fine.
Here's what I've tried:
assuming you're in a database directory with a bunch of *.db files...
tst /db/*.db
#!/bin/sh
### tst
for file in `$1`
do
printf "File: $file\n"
done
or...
for file in `eval ls $1`
do
printf "\n"
done
or...
files=$1
for file in `echo $files`
do
printf "File: $file\n"
done
None of these works...
Hard coding works fine:
for file in `ls /db/*.db`
do
printf "File: $file\n"
done
Any help appreciated,
Julie
.
- Follow-Ups:
- Re: HELP! Scripting newbie question.
- From: Oscar del Rio
- Re: HELP! Scripting newbie question.
- From: tarstarkus
- Re: HELP! Scripting newbie question.
- Prev by Date: Re: output from last has a user psradm, why?
- Next by Date: Re: HELP! Scripting newbie question.
- Previous by thread: Kerberos kadmind will not start
- Next by thread: Re: HELP! Scripting newbie question.
- Index(es):
Relevant Pages
|