set可以用来显示所有变量的值,而export能将一个变量导出,在其子shell或子进程也可见

export和env的区别

两者的作用是一样的,只是env是一个外部工具

基本用法

单纯使用set,可以看到当前shell所定义的所有变量,包含局部和导出;可使用unset 删除一个变量
使用export(env)可以看到所有导出的变量(也就是环境变量); 可使用export VARIABLE的方式定义一个环境变量,或导出一个局部变量为环境变量。

ref

What's the difference of the command output after inputting the command “env”, “export”, “set” under Bash Shell in Solaris?

相关文章:

  • 2021-08-03
  • 2022-12-23
  • 2021-11-27
  • 2021-09-29
  • 2022-12-23
  • 2021-07-09
  • 2019-06-12
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2021-10-24
  • 2021-09-06
  • 2021-07-10
  • 2021-08-03
  • 2022-12-23
  • 2021-11-21
相关资源
相似解决方案