./script creates a new shell and executes each command in the script within the new shell. When the end of the script file is encountered, the new shell exits. Any changes in the new shell caused by the script are lost when the shell exits.
For example, if the file
/home/user/sample/script/test contains...
cd /usr/games
pwd
echo hi
Then the command sequence would yield the following output:
prompt>cd /home/user/sample/script
prompt>pwd
/home/user/sample/script
prompt>chmod +x test
prompt>./test
/usr/games
hi
prompt>pwd
/home/user/sample/script
source Execution
source execute a shell script within the context of the current shell. Since execution takes place within the context of the current shell, any changes in the shell are retained following the completion of the shell.
Example:
prompt>cd /home/user/sample/script
prompt>pwd
/home/user/sample/script
prompt>source test
/usr/games
hi
prompt>pwd
/usr/games
Execing a <command> (ie. shell script or executable) means give exec <command> on the shell prompt.
The exec command will execute a command in place of the current shell, that is, it terminates the current shell and starts a new process in its place.
exec was often used to execute the last command of a shell script. This would kill the shell slightly earlier; otherwise, the shell would wait until the last command was finished. This practice saves a process and some memory.
try exec ls. you will be logged out from your login shell.
exec also manipulates file descriptors in the Bourne shell.
$exec >>logoutput
after issuing this command you will not see output of any command in your console. all output goes into logoutput file.
use exec >/dev/console to return.
$exec 2>errs.out
means that from then on, stderr goes into errs.out file
Tom's summary
1) ./set-env.sh --> start new shell, run it, the new shell exits. --> Env variables not set in the current shell.
2) source ./set-env.sh --> run it the current shell. --> Env variables are set in the current shell.
3) exec ./set-env.sh --> terminate the current shell, start new shell, run it. --> Maybe you just log off immediately.
分享到:
相关推荐
SAP S4HANA Sourcing and Procurement知识点总结 SAP S4HANA Sourcing and Procurement是一个复杂的企业资源规划系统,旨在帮助企业更好地管理采购和供应链。以下是SAP S4HANA Sourcing and Procurement的关键知识...
将vendor/rela589n/doctrine-event-sourcing/config/mappings/为比您的映射具有更高优先级的学说映射目录。 入门 将事件源引入领域模型 用您的实体实现\Rela589n\DoctrineEventSourcing\Entity\AggregateRoot 。 ...
### SAP S/4HANA Sourcing and Procurement认证应用关联知识点 #### 一、SAP Best Practice 内容层次结构 1. **解决方案包(Solution Packages)** 解决方案包是SAP Best Practice 的顶层构建模块,包含了一系列...
1. 职位理解:Sourcing Manager(采购经理)是负责寻找、评估、管理和优化供应链中供应商的角色。他们确保公司能够获得优质、价格合理且按时交付的产品或服务。 2. 行业知识:简历中提到的目标行业包括 Apparel/...
【Sourcing Knowledge in the Mobile Phone Industry】 在信息技术领域,"Sourcing knowledge"指的是获取和管理特定行业或领域的专业知识,以支持决策、创新和业务流程。在手机行业,这涉及到对各种技术、组件、...
Sourcing and Procurement-Central Procurement Sourcing and Procurement-Invoice Integration Sourcing and Procurement-Operational Purchasing Sourcing and Procurement-Procurement Analytics Sourcing and ...
《明基逐鹿Guru e-Sourcing:优化供应链管理的利器》 明基逐鹿Guru e-Sourcing是一款专门针对企业供应链管理的解决方案,旨在帮助企业优化供应商组合,降低采购成本,提升与供应商的合作关系。这款系统的核心在于其...
**Laravel 开发中的事件溯源(Event Sourcing)** 在 Laravel 开发中,事件溯源是一种设计模式,它将应用程序的所有变化记录为一系列不可变的事件。这些事件是系统状态的完整历史,可以用来重建任何时间点的应用程序...
Event Sourcing 和 CQRS 在微服务系统架构中的应用 Event Sourcing 是一种软件架构模式,它将系统状态的变化作为事件的序列来描述。事件源系统会记录所有的状态变化,包括业务逻辑和数据模型的变化。这种架构模式...
Sourcing and Procurement-Central Procurement Sourcing and Procurement-Invoice Integration Sourcing and Procurement-Operational Purchasing Sourcing and Procurement-Procurement Analytics Sourcing and ...
以下是对"Global Sourcing Purchasing Manager"这一职位的详细解析: **职位概述:** 全球采购经理的主要任务是制定和执行全球采购策略,以满足公司的产品需求。他们需要对市场有深入的理解,以确定最具竞争力的...
Sourcing and Procurement-Central Procurement Sourcing and Procurement-Invoice Integration Sourcing and Procurement-Operational Purchasing Sourcing and Procurement-Procurement Analytics Sourcing and ...
event-sourcing, Meteor的CQRS和事件采购基础架构 用于 Meteor的 CQRS &事件源 这个包提供了构建你的Meteor 应用程序的基础设施,以英镑 ( 命令/查询职责分离) 和英镑事件采购原则为基础。 这样可以使用强大的业务...
rails-event-sourcing-example, 带有RabbitMQ的Rails 事件 RabbitMQ事件源示例 运行示例 1确保已经安装并运行 RabbitMQ在macosx上,你可以使用 Homebrew 安装 RabbitMQ$ brew install rabbitmq开始使用$/u
同源开发(Single Sourcing)是一种内容管理方法,它强调创建单一内容源,通过某种方式能够输出多种形式的文档。在信息管理领域,这个概念尤其重要,因为其可以极大提高效率,减少重复工作,并确保文档的一致性。 ...
### 战略采购(Strategic Sourcing)配置指南解析 #### 概述 战略采购作为企业供应链管理中的重要环节,其目标在于通过优化供应商选择、合同管理和采购流程等手段,来提升企业的整体运营效率和成本效益。本文档将...
Oracle Sourcing Implementation and Administration Guide Release 11i 是一份详细的操作手册,旨在为用户提供在Oracle Sourcing系统中实施和管理的全面指导。Oracle Sourcing是一款关键的企业资源规划(ERP)工具...
【深入浅出Event Sourcing和CQRS1】 Event Sourcing是一种架构模式,由著名软件架构师Martin Fowler提出,它在近年来逐渐受到关注。该模式的核心思想是将业务操作记录为一系列不可变的事件,而非传统的数据修改。...
《Python库eventsourcing-2.1.1:事件溯源与分布式系统设计的基石》 在IT行业中,Python作为一门强大的开发语言,拥有丰富的库支持,其中`eventsourcing`库是后端开发中一个重要的工具,它专注于事件溯源(Event ...
《PyPI上的Python库——eventsourcing-1.0.10.tar.gz详解》 在Python的世界里,PyPI(Python Package Index)是开发者们获取、分享和安装第三方库的重要平台。今天我们要关注的是一个名为“eventsourcing”的Python...