title: Convert a string value to integer in c shell script
body: <p>I need to convert a string value to integer in c shell. I am passing a string variable from Python to c shell script and in c shell in need to change it to integer. The variable I am passing is say br ="2" but in c shell in need to change it to integer 2.
  Any solution that allows me to pass an integer value from python to c shell will also help.</p>
  
  <pre><code>import subprocess
  import shlex
  
  var = "nest"
  env_var = "16"
  script = "./testshell.csh"
  
  #prepare a command (append variable to the scriptname)
  command = "{} {}".format(script, var)
  #prepare environment variables
  environment = {"test_var" : env_var}
  
  #Note: shlex.split splits a textual command into a list suited for subprocess.call
  subprocess.call( shlex.split(command), env = environment )
  </code></pre>
  
  <p>This is the test shell script</p>
  
  <pre><code>#!/bin/csh
  
  set br = $test_var
  @ nvar = br + 1
  echo $nvar
  </code></pre>
  
  <p>Error is: @: Expression Syntax.</p>