zoukankan      html  css  js  c++  java
  • linux 执行shell脚本

    1、创建shell脚本:/home/test.sh

    cd /home/

    vim tesh.sh   #linux不区分后缀,.sh 只是为了方便使用者;

    test.sh 文件首行定义格式: #!/bin/bash  表示该文件是用bash shell来执行;

    内容随便写,例如: fdisk -l | grep 'Disk /dev/sda' | awk '{print $3}'     #显示sda分区的大小

    2、执行方式:

    a、相对路径(需要给执行权限):  chmod u+x test.sh

    cd /home

    ./test.sh 

    b、 绝对路径下

    /home/test.sh

    c、 使用bash、sh来执行,不需要给执行权限

    bash test.sh

    sh test.sh 

    有志者,事竟成,破釜成舟,百二秦关终属楚; 苦心人,天不负,卧薪尝胆,三千越甲可吞吴。
  • 相关阅读:
    python day 09 文件操作
    day python calss08 深浅copy
    python.day05
    pytonn04day
    python开发day03
    python开发day02
    python 变量名的规范
    设备描述表
    GDI基础
    windows编程-窗口
  • 原文地址:https://www.cnblogs.com/xw1104/p/7044918.html
Copyright © 2011-2022 走看看