这一切都在使用终端的ubuntu中。
在首次创建文件后寻找文件时,您首先需要read
权限吗?
然后要执行,您需要executable
权限,以便在何时显示x
使用ls -l filename
?
我不确定在您获取资源时哪个进程会执行内容?是current shell
吗?
然后,当您执行调用文件名的脚本时,会使用new shell
进程吗?
开始学习Linux,因此尝试了解脚本的权限和过程。
答案 0 :(得分:1)
做一点实验;
$ echo $$ # print PID of current shell
1234
$ echo 'echo $$' > test.sh # make a little shell script that just prints its PID
$ ls -l test.sh
-rw-rw-r-- 1 hlub hlub 10 Sep 26 20:01 test.sh
# no x'es: not executable
$ source test.sh # source it....
1234
# OK, that worked, even without execute permission,
# .... and we get the same PID:
# .... apparently "source" runs commands in the current shell
$ ./test.sh
zsh: permission denied: ./test.sh
# Oops! need execute permission
$ chmod a+x test.sh # make the script executable
$ ls -l test.sh
-rwxrwxr-x 1 hlub hlub 10 Sep 26 20:02 test.sh
# x'es, just as I expected!
$ ./test.sh
5678
# OK, so now the script executes in a new process!