---
title: "linux  unary operator expected解决方法"
author: "alwaysnew"
date: "2013-10-30T15:31:39Z"
tags: []
categories: ["操作系统"]
slug: "linux-unary-operator-expected"
draft: false
lastmod: "2013-10-30T15:31:39Z"
id: 1966858
url: "https://alwaysnew.iteye.com/blog/1966858"
---

centOs 在 设置了oracle安装环境后，出现了 "unary operator expected"，原因是修改了/etc/profile文件，

增加了这一段：

```
if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
```

当$SHELL 为空时，语句就变成了 if \[  ="/bin/ksh" ]，因此出错，网上搜了解决方案，改成：

```
if [ "$USER" = "oracle" ]; then
    if [ "$SHELL" = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
```