zoukankan      html  css  js  c++  java
  • linux shell执行方式

    linux shell执行有两种方式

    shell脚本以#!/bin/bash开头,执行shell时先检查首行,在内部以下列方式执行:

    $/bin/bash script.sh 

    1. 使用sh执行。

       $sh script.sh #脚本位于当前目录下

    或者

       $sh /home/path/script.sh #使用完整路径

    2. 独立运行脚本。

    需要具备可执行权限,可以通过下面的方式设置

    $chmod a+x script.sh

    或者

    $chmod 755 script.sh

    然后可以通过下列方式执行:

    $./script.sh #./表示当前目录

    或者

    $ /home/path/script.sh #使用完整路径

    --------------------------------------------------------------------------------

    附录:chmod 命令

    chmod [-cfvR] [--help] [--version] mode file...

    chmod owner group world FileName

    ● 4 – read (r)
    ● 2 – write (w)
    ● 1 – execute (x)

    7 = 4+2+1 (read/write/execute)
    6 = 4+2 (read/write)
    5 = 4+1 (read/execute)
    4 = 4 (read)
    3 = 2+1 (write/execute)
    2 = 2 (write)
    1 = 1 (execute)

    + 表示增加权限、- 表示取消权限、= 表示唯一设定权限

  • 相关阅读:
    MySQL Create table as / Create table like
    Oracle CAST() 函数 数据类型的转换
    day 12
    day 11
    day 10
    day 9
    day 8
    day 7
    day 6
    day 5
  • 原文地址:https://www.cnblogs.com/davidwang456/p/3745093.html
Copyright © 2011-2022 走看看