shell script中指令執行的問題 - Linux

Table of Contents

最近裝了一台centos 5.2來測試

對於sh檔的用法還在摸索

但是遇到這樣的問題

sh檔內容

#! /bin/sh
echo "hello world"
echo Working directory is `pwd`
cd /home/test/new
echo `pwd`

但是顯示

Working directory is /home/test
: 沒有此一檔案或目錄 /home/test/new
/home/test

請問為什麼看不到此目錄呢

ls -al結果如下

drwxr-xr-x 2 test test 4096 7月 22 11:20 new



--

All Comments

Catherine avatarCatherine2008-07-26
請下 ls -FTal 查看是否後面有空白字元...
Frederic avatarFrederic2008-07-28
還有 ls -FTal .. 查看上一層目錄
Franklin avatarFranklin2008-08-02
你有Try直接key cd /h...那行試嗎? 也許你可以try
Jacky avatarJacky2008-08-04
cd /home/test/new* 看是否成功,若ok可能是你有些不可字元