[SunHELP] source'ing and $1


Mon May 5 17:31:49 CDT 2003


If I recall correctly, when you source a file, it gets the argument that was
passed to the calling program, not to the sourced file. That might be shell
specific though

-----Original Message-----
From: Markham, Richard [mailto:RMarkham at hafeleamericas.com]
Sent: Monday, May 05, 2003 12:15 PM
To: 'sunhelp at sunhelp.org'
Subject: [SunHELP] source'ing and $1


i want to process $1 within a source'd file and then after processing I want
to set $1 to "".  Otherwise
when I re'source  the same ~command~ file, it will use the last shell value
for $1 even when I dont
specify a value on the command line when calling the source program.

example:
. testprog 1
next time ran
. testprog
$1 would contain "1"
so I need $1 to be set to "" at the end of the command file before the next
source run.

I tried shift but that gives 'bad number' when you run out of parameters.

TIA
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list