---
title: "su导致bash: xxxxxx: command not found解决 (2012-03-12 18:02:19)a"
author: "bluedest"
date: "2012-05-15T11:43:47Z"
tags: []
categories: ["Web前端"]
slug: "su-bash-xxxxxx-command-not-found-2012-03-12-18-02-19-a"
draft: false
lastmod: "2012-05-15T11:43:47Z"
id: 1530064
url: "https://bluedest.iteye.com/blog/1530064"
---

现象：

 

 

 

```
1.登录root账号，使用adduser testuser和passwd testuser新建用户

2.su testuser到新账号下，使用任何命令都显示bash: datestamp_for_history: command not found
```

 

 

 

原因：

 

 

 

```
1.su   只能切换用户权限,不使用原用户的登陆脚本和搜索路径 

2.su - 不但能切换用户权限，还能使用原用户的登陆脚本和搜索路径

之前是在root账号下直接SU切换到testuser用户。
```

 

 

解决：

 

 

 

```
退出换成SU - 再切换到testuser用户就好了。

使用su - 环境变量也跟着来啦~
```