终端中的命令 'chmod +x $1' 有什么作用?

Bru*_*pos 1 command-line bash scripts

我想安装一个应用程序,但我不知道这个命令有什么作用:

chmod +x $1
Run Code Online (Sandbox Code Playgroud)

gui*_*erc 5

该命令chmod用于

更改文件模式位

   The format of a symbolic mode is  [ugoa...][[-+=][perms...]...],  where
   perms  is  either zero or more letters from the set rwxXst, or a single
   letter from the set ugo.  Multiple symbolic modes can be  given,  sepa?
   rated by commas.
Run Code Online (Sandbox Code Playgroud)

(来自man或 参考手册页chmod)。

+x 告诉 chmod 设置execute(或搜索目录)标志。

$1 通常用于脚本中,表示传递给脚本的第一个参数。($0 指的是脚本本身)但是如果 ashift已经执行,参数可能已经改变,所以它是执行时的第一个。