title: Unix Shell Flags
body: <p>I came across <code>$-</code> and found that it  is used to determine the flags set for the shell.So I just did an <code>echo $-</code> and it gave me <strong>ism</strong> . Now  <strong><em>i</strong> is for interactive shell</em>, <strong><em>m</strong> is for monitor mode</em> but I dont know what <strong>s</strong> means.</p>
  
  <p>Moreover I have sample script test.sh as below</p>
  
  <p><code>#!/bin/ksh</code></p>
  
  <p><code>echo "Hi I am shell and I am about to figure out the flags set for me :-)"</code></p>
  
  <p><code>echo $-</code></p>
  
  <p>When I execute the script like this-- <code>./test.sh</code> I am getting the flag as <strong>h</strong> but upon executing <code>sh -x test.sh</code>
   I am getting <strong>xh</strong> . I think this  <strong>x</strong> is coming from <strong>sh -x</strong> but I am not sure how and why.</p>
  
  <p>I tried to google reagrding  the flags but found nothing <em>(maybe because my seach keyword is not proper).</em></p>
  
  <p>Any information on this will be helpful.Thanks in advance :-)</p>