Shell 文件包含
来源:互联网 发布:js 获取复选框选中的值 编辑:程序博客网 时间:2024/04/29 13:49
和其他语言一样,Shell 也可以包含外部脚本。这样可以很方便的封装一些公用的代码作为一个独立的文件。
或
source filename
实例
创建两个 shell 脚本文件。
test1.sh 代码如下:
$ ./test2.sh
官网地址:http://www.runoob.com
Shell 文件包含的语法格式如下:
. filename # 注意点号(.)和文件名中间有一空格或
source filename
实例
创建两个 shell 脚本文件。
test1.sh 代码如下:
#!/bin/bashurl="http://www.runoob.com"test2.sh 代码如下:
#!/bin/bash#使用 . 号来引用test1.sh 文件. ./test1.sh# 或者使用以下包含文件代码# source ./test1.shecho "官网地址:$url"
接下来,我们为 test2.sh 添加可执行权限并执行:
$ chmod +x test2.sh$ ./test2.sh
官网地址:http://www.runoob.com
阅读全文
0 0
- linux shell 包含文件
- shell 文件包含
- shell 包含文件
- Shell文件包含
- Shell文件包含
- Shell文件包含
- shell文件包含
- Shell 文件包含
- Shell文件包含
- Shell文件包含
- shell 文件包含
- Shell 文件包含
- Shell 文件包含
- Shell 文件包含
- Shell 文件包含
- Shell 文件包含
- Shell文件包含~12
- shell 文件包含
- Java Jedis操作Redis示例(五)——Redis的事务、管道和脚本
- leetcode 83. Remove Duplicates from Sorted List
- 认识tcp/ip协议中的http协议
- 创业公司股权架构搭建原则
- linux模块(module_init)、子系统(subsys_initcall)入口函数详解
- Shell 文件包含
- 利用sklearn中的支持向量机回归模型(linear,poly,rbf三种核)对boston房价进行预测并作出评估
- Raft 实现日志复制同步
- yacc 入门 demo
- CSS实现 全屏 遮罩
- python初学——input函数报错
- centos7 dubbo安装
- JDBC中execute、executeQuery和executeUpdate的区别
- jpa中自带方法save和saveAndFlush的区别