Variables in lnav scripts (not env vars) #1186
Answered
by
tstack
ewan-chalmers
asked this question in
Q&A
-
Is it possible to declare and use variables in lnav scripts (not env vars)? |
Beta Was this translation helpful? Give feedback.
Answered by
tstack
Sep 5, 2023
Replies: 1 comment 1 reply
-
You can use a SQL ;SELECT 1 AS one, 'two' AS two And, then reference then in commands that support variable substitution, like
Some commands do not perform substitutions, so you need to use You can also reference the variables in subsequent SQL statements: ;SELECT $one, $two |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ewan-chalmers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use a SQL
SELECT
statement to set variables, like so:And, then reference then in commands that support variable substitution, like
:echo
:Some commands do not perform substitutions, so you need to use
:eval
.You can also reference the variables in subsequent SQL statements:
;SELECT $one, $two