SimonGuest
If I want to supply command line arguments to a .q script how can I do that?
I have an end of day script that backs up data to a certain directory. I want to dynamically specify the location from a shell script.
Hi Simon,
For kdb command line arguments .z.f , .z.x and .Q.opt are the functions you want:
`
C:\temp\dd>echo “show `p” > script.q
C:\temp\dd>q script.q -p 5000 -mvar 101 -myString “hello world”
KDB+ 3.0 2013.03.14 Copyright (C) 1993-2013 Kx Systems
“show `p”
q).z.f / filename of script loaded
`script.q
q).z.x / command line args
“-mvar”
“101”
“-myString”
“hello world”
q).Q.opt .z.x / convert to dict
mvar | “101”
myString| “hello world”
`
As you can see:
.z.f – filename of script loaded at command line
.z.x – string list of command line excluding q/script/kdb-specific-arguments
.Q.opt – convert a list of strings to a dictionary
-
This reply was modified 11 years, 7 months ago by admin.
More details on the q command line arguments can be found here:
http://www.timestored.com/kdb-guides/kdb-command-line-options