2009-08-31 4 views
0
in localpath i have files with names 
myfile1_20090821.dat 
myfile2_20090831.dat 
myfile3_20090811.dat 
myfile4_20090822.dat 
myfile5_20090825.dat 
type="OP" 
module="abc" 
if [ $type == 'OP' ]; then 
case $module in 
abc) x=1 
    while [ $x -le 5 ] 
    do 
    INPUT_FILE[$x]=`ls localpath/myfile$x*.dat` 
    x=$(($x + 1)) 
    done;; 
*) echo "not.......";; 
esac 
fi 

의 제공 오류 :유닉스에서 case 문에 와일드 카드를 사용하는 데 문제가 있습니까?

 
#!/usr/bin/bash 

type="OP" 
module="abc" 
if [ $type == 'OP' ]; then 
case $module in 
abc) x=1 
    while [ $x -le 5 ] 
    do 
    INPUT_FILE[$x]=`ls localpath/myfile$x*.dat` 
    x=$(($x + 1)) 
    done;; 
*) echo "not.......";; 
esac 
fi 

는 오류 메시지를 제공하지 : LS의 localpath/myfile을 $ 1 *는

이 PLZ 나에게 프로그램의

답변

1

기본 스크립트는 "localpath를"

즉의 상위 디렉토리에서 실행하면 당신은 당신이 볼 수 스크립트를 실행하는 디렉토리에서 'LS'을 할 경우에만 작동합니다, 유효 보이지만, localpath 디렉토리가 나열됩니다.

디렉토리의 완전한 자격을 시험해보십시오.

0

내 버전을 도움이 발견되지 .DAT. 당신 버전에 속임수 선이 있습니까?

사실, 내 물건은 또한 속박도없이 작동합니다. Cygwin을 사용하고 있습니다.

관련 문제