zoukankan      html  css  js  c++  java
  • shell 编程基础(1)---初识shellscript

    shellscript 是linux下强大的系统管理工具,可以通过bash命令和管道命令直接在linux系统上进行编程,所写的脚本不需要编译就可以执行,对于系统管理而言十分方便。

    #!/bin/bash

    //指定所需要使用的bash(不写貌似也能运行)

    #program
    #   this is my first program about shell
    #   data 2015 5 7  cxz
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
    export PATH

    //指定环境变量,使程序能在任何目录下运行(写了貌似也没用)

    echo -e "helloworld a 
    "
    exit 0  

    运行程序时使用指令sh sh01.sh或者直接修改.sh文件的权限chmod 722 *.sh
    上述脚本用来在屏幕上打印helloworld

    #program
    #test the function read
    #20150507
    read -p "type in your first name   " firstname
    read -p "type in your last name    " lastname
    echo -e "****
    *****" ${firstname} ${lastname}

    使用read 语句给环境变量赋值,并使用echo打印,在read -p中是无法使用 来进行换行的。

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    第 9 章 类
    导入模块
    第 8 章 函数
    第七章 用户输入和while语句
    第六章 字典
    测试经理/组长职责
    测试的发展之路
    【转】测试流程
    一个网页通用的测试用例(借鉴他人的保存,加注释)
    QTP自动化测试框架简述
  • 原文地址:https://www.cnblogs.com/ironstark/p/4892644.html
Copyright © 2011-2022 走看看