由C程序设置的env变量,无法从bash脚本中检索

时间:2018-05-31 22:07:21

标签: linux bash shell scripting

C程序:(文件名:temp.c)

main ()
{
  putenv ("VERSION");
  setenv ("VERTSION","1.0",1);
  printf ("%s\n\r",getenv ("VERSION");

  exit (0);
}

Cprogram的输出: 1.0

=============================================== ===========

Bash脚本:

./temp
echo "Ver from bash:"$VERSION

输出bashscript:

1.0                        **(from c program)**
Ver from bash:             **(from bash shell, why wont $VERSION get output here?)**

0 个答案:

没有答案