[comp.unix.shell] at command args

mostek@motcid.UUCP (Frank B. Mostek) (11/14/90)

Would like to be able to pass parameters to a script invoked by the
"at" command.  Have tried:

	at now + 1 minute test xyz

	where xyz is the parameter I want to pass to the test
	script.

The script is executed, but the parameter is ignored.

renkel@motcid.UUCP (Willis H. Renkel) (11/14/90)

In article <5195@crystal1.UUCP>, mostek@motcid.UUCP (Frank B. Mostek) writes:
> Would like to be able to pass parameters to a script invoked by the
> "at" command.  Have tried:
> 
> 	at now + 1 minute test xyz
> 
> 	where xyz is the parameter I want to pass to the test
> 	script.
> 
> The script is executed, but the parameter is ignored.

rob@b15.INGR.COM (Rob Lemley) (11/15/90)

In <5195@crystal1.UUCP> mostek@motcid.UUCP (Frank B. Mostek) writes:

>Would like to be able to pass parameters to a script invoked by the
>"at" command.  Have tried:

>	at now + 1 minute test xyz

>	where xyz is the parameter I want to pass to the test
>	script.

>The script is executed, but the parameter is ignored.

First, a caveat, aside from any problems with "at":

	BE CAREFUL WHEN YOU NAME A SCRIPT test.  test IS A BUILTIN
	COMMAND IN THE MODERN sh AND ksh.  EXECUTING test WITHOUT A
	QUALIFYING PATH NAME WILL USUALLY EXECUTE THE SHELL'S BUILTIN
	test COMMAND OR /bin/test ON OLDER SHELLS.  ON OLDER SHELLS
	THIS WILL DEPEND ON HOW YOUR $PATH IS SET UP.  NAMING YOUR OWN
	SCRIPT test CAN ALSO CAUSE OTHER SHELL SCRIPTS TO BREAK BECAUSE
	THEY PROBABLY EXPECT DIFFERENT BEHAVIOR FROM test THAN WHAT YOU
	PROBABLY CODED!

Now, back to "at":

Are you sure the script is executed? What version of Unix are you on?
On System V, Release 3, "at" will not take commands from the command line.

When I try your example, I get:

	at: bad date specification

The usual way to do this would be:

	$ at now + 1 minute
	test xyz
	<control-d>	#or whatever your EOF char is

From the User's Ref Man:
          at and batch read commands from standard input to be
          executed at a later time.       ^^^^^^^^^^^^^^

Rob
--
Rob Lemley
System Consultant, Scanning Software, Intergraph, Huntsville, AL
rcl@b15.ingr.com		OR		...!uunet!ingr!b15!rob
205-730-1546