存储数组值Unix Solaris Korn Shell时出现语法错误问题 [英] syntax error issue while storing array value Unix Solaris Korn Shell

查看:65
本文介绍了存储数组值Unix Solaris Korn Shell时出现语法错误问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在shell脚本中的命令.

Here is my command in shell script.

x=($(echo $x1 | cut -f3 -d" " | cut -f1 -d"]"))

第818行的

语法错误:`('意外

syntax error at line 818 : `(' unexpected

如果我删除此行,则该行有效

注意:当我在Solaris上尝试运行该脚本时,该脚本将在Linux OS中运行.

Note: The same script runs in Linux OS when i try it in Solaris it throws error.

推荐答案

在下面执行一次即可..使用ksh ..

execute below one it will work..using ksh..

x1="test1 test2 test3]testarray test"
x="$(echo $x1 | cut -f3 -d" " | cut -f1 -d"]")"
echo $x

这篇关于存储数组值Unix Solaris Korn Shell时出现语法错误问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆