[root@centos2 ~]# ls
anaconda-ks.cfg bin testt.sh
[root@centos2 ~]# . testt.sh
hello word
[root@centos2 ~]# ll -ah testt.sh
-rw-r--r-- 1 root root 31 Apr 6 01:18 testt.sh
[root@centos2 ~]#
anaconda-ks.cfg bin testt.sh
[root@centos2 ~]# . testt.sh
hello word
[root@centos2 ~]# ll -ah testt.sh
-rw-r--r-- 1 root root 31 Apr 6 01:18 testt.sh
[root@centos2 ~]#
[root@centos2 ~]# cat .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
以往执行文件时都是用./file_name的形式,查阅了资料得知:
1、 如果我们要执行某个文件,但是此文件不可执行,此时我们要用chmod u+x file_name来使文件具有可执行权限
2、可是有时我们不想更改此文件的执行权限,但又想执行此文件,可以采用(点号--空格--文件名)的形式来执行一个脚本(只有root用户才可以这么做)