码迷,mamicode.com
首页 > 系统相关 > 详细

linux sheel script demo

时间:2017-04-10 16:32:32      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:bin   targe   cal   script   name   edit   his   输入   系统环境   

1. target :

    输入姓、名, 输出姓名

2. create directory

     mkdir ~/bin

3. create & edit sheel script

    vim fullname.sh

    note:  more comment is useful

#!/bin/bash
#Program
#       User inputs his first name and last name . Program shows his full name.
#History :
#2017/04/10     logan   First lease
PATH=/bin:$PATH #将当前目录加入系统环境
export PATH
read -p "Please input your firstname:" firstname
read -p "Please input your lastname:"   lastname 
echo -e "\nYour full name is :" ${firstname} ${lastname}

 4. run

   [rocky@localhost bin]$ sh fullname.sh

linux sheel script demo

标签:bin   targe   cal   script   name   edit   his   输入   系统环境   

原文地址:http://www.cnblogs.com/rocky-fang/p/6689592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!