你好,游客 登录 注册 搜索
背景:
阅读新闻

第一个Unix Shell函数

[日期:2013-02-02] 来源:Linux社区  作者:bobo12082119 [字体:大 中 小]

凡事都有个开头;有句话说,万事开头难;不管以后的路怎么样,走好脚下的每一步。

今天接触到了Unix shell中的函数,记录下,写了个hello函数,如下:

pg fun_hello.sh
#!/bin/ksh

hello () {
  echo "Hello ,this is my first Shell function!"
  echo "Today is `date +%Y-%m-%d\ %H:%S:%M\ %A`"
}
#Call hello function
hello
#EOF

执行脚本:

sh fun_hello.sh
Hello ,this is my first Shell function!
Today is 2013-02-01 15:48:25 Friday

Unix Date命令 http://www.linuxidc.com/Linux/2013-02/78923.htm

--the end--

linux
相关资讯       Shell函数  Unix shell 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款