`
61party
  • 浏览: 1123032 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Plan9 Environment Variables -- Notes of Introduction to OS Abstractions Using Plan 9 from Bell Labs(III)

 
阅读更多

The interface for using environment variables in Plan 9 is a file interface. All interfaces of environment variables can be found under /env.

To obtain the value for a environment variable, from a C program, we can use the getenv system call. If the variable is not defined, getenv returns a null string. A related call is putenv, which accepts a name and a value, and set the corresponding environment variable accordingly.

In some cases it is convenient to define an environment variable just for a command. This can be done by defining it in the same command line, before the command, like in the following exam-ple:

Useful Environment Variables:

status is updated by the shell once it finds out how it went to the last command it executed.

path is a list of paths where the shell should look for executable files to run the user commands.

user contains the user name .

sysname contains the machine name.

The file /dev/text represents the text shown in the window (when used within that window). To make a copy of your shell session, you already know what to do:

; cp /dev/text $home/saved

The same can be done for the image shown in the display for your window, which is also represented as a file, /dev/window. This is what we did to capture screen images .

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics