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 \n"
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 "****\n*****" ${firstname} ${lastname}

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值