Results 1 to 2 of 2
I'm trying to use this script, but it's not working:
Code:
ubuntu@ubuntu:~/Desktop$ cat ./script.sh
#!/bin/sh
if [ -e ./000[0-9].cat ]
then
echo "meow"
else
echo "woof"
fi
ubuntu@ubuntu:~/Desktop$ bash -x ...
- 06-29-2008 #1
metacharacters and if-then statements
I'm trying to use this script, but it's not working:
Is there a proper way to do this?Code:ubuntu@ubuntu:~/Desktop$ cat ./script.sh #!/bin/sh if [ -e ./000[0-9].cat ] then echo "meow" else echo "woof" fi ubuntu@ubuntu:~/Desktop$ bash -x ./script.sh + '[' -e ./0000.cat ./0001.cat ./0009.cat ']' ./script.sh: line 2: [: too many arguments + echo woof woof
I have files 0000.cat 0001.cat 0009.cat and 0010.cat
- 06-29-2008 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
go through every .cat file
Code:for F in *cat do case $F in 000[0-9]* ) echo "meow" ;; * ) echo "sdfs";; esac done


Reply With Quote