blob: 67d13d211f91f479da333df2f5c2aeaef37077da (
plain) (
blame) 
 | 1 2 3 4 5 6 7 8 9  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">3.3.4. Command-Line Arguments</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="publican v4.1.3" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.6-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="scriptconstructions.html" title="3.3. Basic SystemTap Handler Constructs" /><link rel="prev" href="handlerconditionalstatements.html" title="3.3.3. Conditional Statements" /><link rel="next" href="associativearrays.html" title="3.4. Associative Arrays" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="https://fedorahosted.org/publican"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="handlerconditionalstatements.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="associativearrays.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="commandlineargssect"> </a>3.3.4. Command-Line Arguments</h3></div></div></div><a id="idm213967884160" class="indexterm"></a><a id="idm214018570432" class="indexterm"></a><a id="idm214018642432" class="indexterm"></a><div class="para">	A SystemTap script can also accept simple command-line arguments using a <code class="command">$</code> or <code class="command">@</code> immediately followed by the number of the argument on the command line. Use <code class="command">$</code> if you are expecting the user to enter an integer as a command-line argument, and <code class="command">@</code> if you are expecting a string. </div><div class="example"><a id="commandlineargs"> </a><p class="title"><strong>Example 3.12. commandlineargs.stp</strong></p><div class="example-contents"><pre class="programlisting">probe kernel.function(@1) { } probe kernel.function(@1).return { }</pre></div></div><div class="para"> <a class="xref" href="commandlineargssect.html#commandlineargs">Example 3.12, “commandlineargs.stp”</a> is similar to <a class="xref" href="scripts.html#wildcards">Example 3.1, “wildcards.stp”</a>, except that it allows you to pass the kernel function to be probed as a command-line argument (as in <code class="command">stap commandlineargs.stp <em class="replaceable">kernel function</em></code>). You can also specify the script to accept multiple command-line arguments, noting them as <code class="command">@1</code>, <code class="command">@2</code>, and so on, in the order they are entered by the user. </div><a id="idm214018850480" class="indexterm"></a><a id="idm213972626800" class="indexterm"></a><a id="idm213971992432" class="indexterm"></a></div><ul class="docnav"><li class="previous"><a accesskey="p" href="handlerconditionalstatements.html"><strong>Prev</strong>3.3.3. Conditional Statements</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="associativearrays.html"><strong>Next</strong>3.4. Associative Arrays</a></li></ul></body></html> 
 |