LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   can somebody help me in fixing the script (http://www.linuxquestions.org/questions/linux-general-1/can-somebody-help-me-in-fixing-the-script-107633/)

jdara1 10-23-2003 12:05 PM

can somebody help me in fixing the script
 
I have got one requirement, this script works in AIX but not in linux can somebody fix this problem.

Here is the script.

[u01pms20@u060ms20 scripts]$ cat t.ss

#!/bin/bash


if [ -f [cdtl0-9][0-9][0-9][0-9]*([0-9]).[0-9][0-9][0-9] ]; then
echo "yes"
fi

[u01pms20@u060ms20 scripts]$ touch 1234.000

[u01pms20@u060ms20 scripts]$ ./t.ss
./t.ss: line 4: syntax error near unexpected token `[cdtl0-9][0-9][0-9][0-9]*(['
./t.ss: line 4: `if [ -f [cdtl0-9][0-9][0-9][0-9]*([0-9]).[0-9][0-9][0-9] ]; then'

But the same script works in AIX box.

u060win3 stg /tmp>cat t.ss
#!/bin/ksh


if [ -f [cdtl0-9][0-9][0-9][0-9]*([0-9]).[0-9][0-9][0-9] ]; then
echo "yes"
fi

u060win3 stg /tmp>touch 1234.000
u060win3 stg /tmp>./t.ss
yes

Infact in Linux, when I change the script header to #!/bin/ksh
then I get this error
[u01pms20@u060ms20 scripts]$ ./t.ss
./t.ss[6]: [: 12345.000: unexpected operator/operand

Whether it is korn or bash , I am getting error in linux, can some gurus help me out. Once this is fixed, I am going to implement this login in a big script.

Thanks
Jagadish

trickykid 10-23-2003 12:12 PM

Probably can't help without more details or more of the script included as I have no idea what your trying to accomplish with a simple:

Code:

if [ -f [cdtl0-9][0-9][0-9][0-9]*([0-9]).[0-9][0-9][0-9] ]; then
echo "yes"
fi

What is that suppose to do and where?

Also, Linux is not AIX so path's and files can make a difference in referencing them on different systems, etc.

trickykid 10-23-2003 12:18 PM

Closed, part of a triple post. You can reply to his original one here: http://www.linuxquestions.org/questi...hreadid=106830


All times are GMT -5. The time now is 03:49 PM.