about export(enviroment variable set) command

jase 2000-01-01 10:18:00
Hi,
I have a question about export command. Under unix, I try to make a file set enviroment variable. the command export under PS can work, but in my file cant work.
for example, under ps, "export bs=2" can set bs as enviroment variable, but in my file put this command does not work. but i put the command to the .bashrc file, it works. why?
special thanks for your help!!






...全文
220 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
netmare 2000-01-30
  • 打赏
  • 举报
回复
when u execute a script,there a new shell will be forked to do this job,and then ur env var will set under this shell,and when ur script done,the shell will exit,and like '.profile','.bashrc' is an init script,it will be execute when u login with this uid,and it will effect to ur shell which forked at this time.
zlw 2000-01-17
  • 打赏
  • 举报
回复
if you execute a script just by type its name,a new shell will be forked and execute your file,the enviroments modified by the sub shell won't affect your orignal shell.so you should execute your script with "source" or "." command,for example,". your-script".(this work under linux/bash,i think unix will work too)
beck 2000-01-05
  • 打赏
  • 举报
回复
u can try function putenv( ... )

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧