Linux命令——source
前言
当我们修改了/etc/profile文件,并想让它立刻生效,而不用重新登录,就可以使用source命令,如source /etc/profile。
source命令
source是一个内建命令。下面命令执行环境是Ubuntu 16.04.3 LTS下的bash。事实上source命令并不是bash(Bourne shell)内置的,他是GNU项目后来扩展引入的。其他shell不确定是否有source命令。
Linux命令——type、which、whatis、apropos、whereis、find
root@ubuntu:~# type source
source is a shell builtin
除了type可以查看source,help命令也可以
root@ubuntu:~# help source
source: source filename [arguments]
Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed. Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.
但是man,whatis命令就不可以查看source命令了
root@ubuntu:~# man source
No manual entry for source
root@ubuntu:~# whatis source
source: nothing appropriate.
考虑到和其他shell的兼容性,最好使用点号 . 。点号.是source的同义词,为啥使用source而不是.,可能的原因是:写.有时候看起来像是写错了的命令,用source更直观。
但是从简洁的角度看,实在没必要打那么多字来实现一个和.一样的功能
./ 和 source 不完全一样
./scriptruns the script as an executable file, launching a new shell to run itsource scriptreads and executes commands from filename in the current shell environment
Note: ./script is not . script, but . script == source script

Linux命令——source的更多相关文章
- Linux命令:source
语法 source filename 说明 . 的同义词
- Linux命令随笔
Linux命令总结 man ==命令帮助; help ==命令的帮助(bash的内置命令); ls ==list,查看目录列表; -ld:查看目录权限; -l:(long)长格式显示属性; -F:给不 ...
- 我常用的那些linux命令
我常用的那些linux命令 用linux也有些年头了,说来也忏愧,说是有些年头了,其实也还是个不长进的主.记得第一次接触linux是boss跟我说的怎么操作,什么编辑模式,按i,a,o进入编辑模式.在 ...
- Java开发必会的Linux命令
Java开发必会的Linux命令 作为一个Java开发人员,有些常用的Linux命令必须掌握.即时平时开发过程中不使用Linux(Unix)或者mac系统,也需要熟练掌握Linux命令.因为很多服务器 ...
- [z]Java开发必会的Linux命令
1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件. find . -name "*.xml" 递归查找所有的xm ...
- Linux命令整理中...
Linux命令整理中... 最常用命令(我最近最常用的一般放在前面tipsbychsry) clear 清屏 date 显示日期 cal 显示日历 cal 2014 显示2014年的日历 shutdo ...
- Linux 命令小记
1. pidof 进程名 :获取进程的pid,例如 pidof memcached 得到5333 2. unset Shell变量 :取消设置一个shell变量,从内存和shell的导出环境中删除它, ...
- LINUX命令总结 -------来自 水滴娃娃 的CSDN
LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报 分类: linux(1) 版权声明:本文为博主原创文章,未经博主允许不得 ...
- [Android ] linux命令英文缩写的含义(方便记忆)
du -sh */ reference to : http://blog.chinaunix.net/uid-27164517-id-3299073.html linux常用命令的英文单词缩写 命令缩 ...
随机推荐
- WAV相关:从PCM16 Little Endian数据转WAV文件
数据格式 [0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 5.960464477539063e-08, 5.960464477539063e-08, 1.19209289550781 ...
- LeetCode_217. Contains Duplicate
217. Contains Duplicate Easy Given an array of integers, find if the array contains any duplicates. ...
- /var/spool/postfix
centos磁盘优化,发现/var/spool/postfix/maildrop下有大量文件. cron进程默认会将计划任务中所运行的脚本的警告.错误信息或者脚本输出信息发送给计划任务的所有者,而由于 ...
- bootstrap-table和bootstrap-switch
{% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta ...
- consul分布式集群搭建&简单功能测试&故障恢复【h】
环境准备五台机器: 操作系统 IP Ubuntu 16.04.3 LTS x86_64 192.168.1.185 Ubuntu 16.10 x86_64 192.168.3.152 Ubuntu 1 ...
- gcr 镜像无法下载问题
GCR Proxy Cache 帮助 GCR Proxy Cache服务器相当于一台GCR镜像服务器,国内用户可以经由该服务器从gcr.io下载镜像. 使用GCR Proxy Cache从gcr.io ...
- flask的信号使用
from blinker import Namespace from datetime import datetime from flask import request namespace = Na ...
- C++ 字符串处理类 ProcessString (包含常用字符串处理函数)
ProcessString.h //Linux & C++11 #pragma once //包含系统头文件 #include <string> #include <sstr ...
- AVR单片机教程——序言
我一直觉得现在的网络环境对电子技术的学习有一点问题,但始终无法确切地指出,更何况网络上相关资源已经那么丰富. 但我觉得是问题的,无论它到底是不是问题,对我来说总归是一个问题.我学习也不算深入,很多东西 ...
- linux学习之路(二)--centos7安装Redis(单点)
一.安装redis 1.进入/usr/local/,新建services目录,进入该目录,下载redis wget http://download.redis.io/releases/redis-4. ...