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

Re: shell scripts



On Wed, Jun 06, 2001 at 10:22:12AM -0600, Jason W Elliot <jelliot math cudenver edu> wrote:
| > >> Correct, since the 5 files will be assigned to $1 through $5.  You are
| > >> only looking at $1.  You need to use $*.  If you were to test each of the
| > >> files for some reason, then a for loop would be needed.
| > >I obviously only need to test once. You mean replace '$1' with '$*'?
| > >	-Jason
| > Yes.  I'm saying that if you need to test the files you are going to move,
| > for any reason, you'll have to add a for loop in order to be able to do that.
| > Otherwise, just replacing $1 with $* will solve your problem.
| Thanks. This works. It seems that $@ works also.

Good. Now go and read the manual carefully. You will find that

	$*
	"$*"
	"$@"

all act a bit differently. Having read the manual, now figure out what

	${1+"$@"}

means, which is the kosher way of grabbing the original arguments for
use elsewhere.
-- 
Cameron Simpson, DoD#743        cs zip com au    http://www.zip.com.au/~cs/

Until a man is married, he is incomplete.
After he is married, he is finished!	- Zsa Zsa Gabor





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