当前位置: 首页 > news >正文

360免费建站为什么注册不了网站源代码在哪里

360免费建站为什么注册不了,网站源代码在哪里,php与mysql网站开发全接触,visual studio制作网站开发1. 命令行参数------类似javac 参数1 参数2 类似Java中编译的javac parm1....。在shell中#xff0c;参数与参数之间用空格隔开。采用位置参数来识别对应的参数值#xff1a;$0是程序名#xff0c;$1是第一个参数#xff0c;以此类推#xff0c;知道第9个参数$9。对于大… 1.  命令行参数------类似javac  参数1 参数2      类似Java中编译的javac parm1....。在shell中参数与参数之间用空格隔开。采用位置参数来识别对应的参数值$0是程序名$1是第一个参数以此类推知道第9个参数$9。对于大于9个参数的需要在变量数字周围添加花括号比如${10}。      note:命令行上不仅可以处理数值还可以处理字符串。 1 [Hermionerlocalhost Documents]$ cat test2.sh2 #!/bin/bash3 total$[ $1*$2 ]4 echo The first parm is $15 echo The second parm is $26 a$37 echo the third parm is $38 b$49 echo the forth parm is $4 10 [Hermionerlocalhost Documents]$ bash test2.sh 2 3 hello world min 11 The first parm is 2 12 The second parm is 3 13 the third parm is hello world 14 the forth parm is min View Code 1 [Hermionerlocalhost Documents]$ cat test3 2 #!/bin/bash 3 echo the tenth parm is ${10} 4 echo the eleventh parm is ${11} 5 [Hermionerlocalhost Documents]$ bash test3 1 2 3 4 5 6 7 8 9 10 11 6 the tenth parm is 10 7 the eleventh parm is 11 8 [Hermionerlocalhost Documents]$ View Code       note: $0返回脚本名如果用bash就只返回脚本名如果./脚本来运行返回当前路径名  因此还可以尝试basename命令来返回不包含路径的脚本名。 2. $#$*$${!#}     s#      用来统计命令行的参数个数     s*       用来访问所有的命令行参数并且构成一个字符串整体输出     s     同s*只是结果是分散成字符串数组每个数组中的元素都是一个参数     ${!#}   代表的最后一个参数因为花括号中不可以用$因此用来代替它 1 [Hermionerlocalhost Documents]$ cat testfile2 #!/bin/bash3 echo the \$* is $*4 echo the \$ is $5 echo the \$# is $#6 echo the \${!#} is ${!#}7 8 [Hermionerlocalhost Documents]$ bash testfile a b c d9 the $* is a b c d 10 the $ is a b c d 11 the $# is 4 12 the ${!#} is d View Code 1 [Hermionerlocalhost Documents]$ cat testfile2 #!/bin/bash3 echo4 count15 for param in $*6 do 7 echo \$* Parameter #$count $param8 count$[ $count1 ]9 done 10 11 echo 12 count1 13 for param in $ 14 do 15 echo \$ Parameter #$count $param 16 count$[ $count1 ] 17 done 18 19 [Hermionerlocalhost Documents]$ bash testfile a b c d 20 21 $* Parameter #1 a b c d 22 23 $ Parameter #1 a 24 $ Parameter #2 b 25 $ Parameter #3 c 26 $ Parameter #4 d 27 [Hermionerlocalhost Documents]$ View Code 3. shift 移动变量        shift可以用来在不知道有多少参数以及每个参数的值的情况下进行遍历因为它始终可以只打印第一个值。默认情况下它会将每个参数变量向左移动一个位置。所以变量$3的值会移动到$2中$2的值会移动到$1中而变量$1的值则会被删除note:$0代表程序吗不会改变      也可以shift n 来指定左移动多少个eg: shift 2   则$3的会移动到$1中这样就可以跳过一些值不遍历了。 1 [Hermionerlocalhost Documents]$ cat test3.sh 2 #!/bin/bash 3 echo the original parameters is $* 4 shift 2 5 echo the new first parameter is $1 6 [Hermionerlocalhost Documents]$ bash test3.sh 1 2 3 4 5 7 the original parameters is 1 2 3 4 5 8 the new first parameter is 3 9 [Hermionerlocalhost Documents]$ View Code      note:配合shift的使用同样可以通过shell脚本中的逻辑来判断是选项还是参数从而让参数得到应有的输出。并在在bash shell中还提供了getopt和getopts来判断是选项还是参数-------用时参考它们用法即可。 4. 获取用户输入-------交互性更强类似java中的scannersystem.in用法     采用read命令。read后面跟变量名就可以将输入的值保存到变量中如果不输入变量名那么就自动保存在了特殊环境变量REPLY中。 1 [Hermionerlocalhost Documents]$ cat test1 2 #!bin/bash 3 echo -n Enter your name: 4 read name 5 echo hello $name 6 [Hermionerlocalhost Documents]$ bash test1 7 Enter your name:Tom 8 hello Tom 9 [Hermionerlocalhost Documents]$ View Code       note1:如果用户一直不输入read会一直等待因此可以设置计时器用-t选项。时间过了就不等了。       eg:read -t 5 name       note2: 类似密码输入隐藏方式读取只需要添加 -s就可以       note3: 还可以从文件中读取一行一行的读取 1 [Hermionerlocalhost Documents]$ cat test12 #!bin/bash3 a4 b5 c6 [Hermionerlocalhost Documents]$ cat test27 #!/bin/bash8 cat test1 | while read line #采用了管道9 do 10 echo the line is $line 11 done 12 echo read is done 13 [Hermionerlocalhost Documents]$ bash test2 14 the line is #!bin/bash 15 the line is a 16 the line is b 17 the line is c 18 read is done 19 [Hermionerlocalhost Documents]$ View Code 补充管道      command1 | command2   就是将命令1的输出重定向到了command2中。 可以多级重定向多添加|就好了。   参考文献 Linux命令行与shell脚本编程大全第3版[美] 布鲁姆Richard Blum布雷斯纳汉Christine Bresnahan 著门佳武海峰 译   转载于:https://www.cnblogs.com/Hermioner/p/9383629.html
http://www.sadfv.cn/news/51782/

相关文章:

  • 简约网站版式国内十大平面设计公司
  • 广州哪家做网站价格好广东短视频推广公司
  • 内蒙古知名网站建设广告模板图片
  • 东莞制作网站公司哪家好域名网址注册
  • 南宁网站定制公司下载百度app下载
  • 360度网站模板上海网站建设的
  • 站长素材网yandex搜索引擎入口
  • 360网站导航公司地址怎么做由音乐学院做的网站
  • app设计模板网站域名是什么意思
  • 找人开发一个网站多少钱建筑工程承包合同书
  • 企业网站的首页展示网站多少钱一个
  • 帮别人设计网站的网站吗成都企业网站排名优化
  • 网站搭建的策略与方法手机开发游戏的软件
  • 如何制作网站要钱吗学网络运营去哪里学
  • 优秀网站推荐河北专业网络营销收费公司
  • 手机怎么自创网站系统页面设计的原则
  • 杭州网站建设及推广做百度移动端网站排名软件
  • 网站前端工资高报师培训机构排名
  • 做网站用什么字体最明显织梦动漫网站模板
  • 甘肃住房和城乡建设局网站国际物流网站制作模板
  • 如何利用网站新闻做推广响应式网站应该怎么做
  • 做推送用的网站制作公司网站源代码怎么弄
  • 双语网站费用网站底版照片怎么做
  • 个人网站建设开题报告深圳网站建设公司招聘电话销售
  • 南京移动网站建设报价Wordpress图墙主题
  • 律师事务所公司类网站建设案例纪检监察门户网站建设论证报告
  • 业绩统计网站开发西双版纳傣族自治州勐海县
  • 包装设计网站哪个好用临海市建设局网站
  • 天河网站建设报价江门建设局网站
  • 易用的做网站软件新密网站