Really basic question
I'd like to call a .ck program from the Mac OSX Terminal command line, and feed values to variables in the given program. For example, here's my program 'fooprint.ck': =begin program <<< foo >>> ; =end program So on the command line I'd like to write &> chuck fooprint.ck --foo=25 or whatever. What do I add to the program, and/or what do I add to the command to make this happen? -- Philipp Blume
In the terminal you enter all the args with colon separators. In your example, you'd do: %> chuck fooprint.ck:25 Within your code, use me.args() to get the arg count, and me.arg(i) to get each arg (starting at i=0). (BTW, somewhere in the documentations it says to use me.numArgs() to get the arg cnt, but that doesn't seem to work.) On Sep 18, 2014, at 3:29 PM, Philipp Blume wrote:
I'd like to call a .ck program from the Mac OSX Terminal command line, and feed values to variables in the given program.
For example, here's my program 'fooprint.ck':
=begin program
<<< foo >>> ;
=end program
So on the command line I'd like to write
&> chuck fooprint.ck --foo=25
or whatever.
What do I add to the program, and/or what do I add to the command to make this happen?
-- Philipp Blume _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Daniel Chapiro
-
Philipp Blume