syntax error near unexpected token `local'
来源:互联网 发布:wp7软件下载 编辑:程序博客网 时间:2024/06/05 22:49
问题描述
function testit{ local newarray newarray=($(echo $@)) echo "the new array is ${newarray[*]}"}myarray=(1 2 3 4)echo the original array is ${myarray[*]}testit ${myarray[*]}
运行这样一段代码出现了问题,报错syntax error near unexpected token `local’
解决方法
在shell中,函数名称和中括号之间需要有空格,即testit {
function testit { local newarray newarray=($(echo $@)) echo "the new array is ${newarray[*]}"}
阅读全文
0 0
- syntax error near unexpected token `local'
- syntax error near unexpected token `
- syntax error near unexpected token `('
- “syntax error near unexpected token `”
- syntax error near unexpected token `
- libtool: syntax error near unexpected token `]*'
- 错误:syntax error near unexpected token `then'
- syntax error near unexpected token `('解决方法
- : syntax error near unexpected token `done'
- 脚本报syntax error near unexpected token `(',
- syntax error near unexpected token `elif'
- libtool: syntax error near unexpected token `]*
- syntax error near unexpected token `then'
- “syntax error near unexpected token `then'”错误
- syntax error near unexpected token else
- syntax error near unexpected token ?怎么解决
- shell syntax error near unexpected token
- syntax error near unexpected token `then'
- Zookeeper集群安装
- 借助LVS+Keepalived实现负载均衡
- 抓包时碰到的问题:the server refused this request because the request entity is in a ......
- 【算法分析与设计】【第二周】4.Median of Two Sorted Arrays
- 其他常用标记
- syntax error near unexpected token `local'
- 练习5: 输入一个一维数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。
- ggplot2--绘图基础
- selenium知识点小结
- .Net 操作Word
- Oracle函数(常见的20种)+三层嵌套分页...等多种Oracle的sql(常用)
- 创业五年感受
- javascript字符串string常用的几种方法(indexOf/lastIndexOf/search/charAt/match/slice/substr/replace/concat/split
- 《浅谈如何坚持》鸡汤阅后笔记