hi,
i need to check the existence of all files starting with abc in a directory. The code works fine with a particular file name, but the file existence is not detected when i use wildcard character (abc*)
kindly suggest what could be the issue
For testing purpose there is only one file present in the directory whose name starts with abc.
I tried the following code like you have suggested
This is evaluating the src_filename1 as only the AI_LANDING path without the file name, and giving the result as EXISTS! even when the file is not present.
Any suggestions?
---------- Post updated at 01:47 AM ---------- Previous update was at 01:46 AM ----------
Quote:
Originally Posted by 116@434
Can you check once with set -x option enabled and paste the output?
Thanks for your reply. how can i check the set -x option option?
Last edited by Franklin52; 05-09-2011 at 05:59 AM..
Reason: Please use code tags
This is evaluating the src_filename1 as only the AI_LANDING path without the file name, and giving the result as EXISTS! even when the file is not present.
If it evaluates src_filename1 as the path, then it does exist -- it's the directory $AI_LANDING. And it's not empty, so the test passes. All kosher there.
As for your original problem, I'd put it in a for loop:
Reading through your original post I have to ask:
Quote:
For testing purpose there is only one file present in the directory whose name starts with abc.
Is this "testing - purposes" file named abc<somethin> empty by any chance? Because then it wouldn't pass your test...
When you want to test for existence, use
test instead. -f returns true if the file exists and is a regular file (as opposed to a directory, block or special device, etc.)
Dear All,
I have script.
Dest=""
IFS='
'
for translation in $(echo $MY_MAP)
do
t1=$(echo $translation | cut -d"=" -f1)
t2=$(echo $translation | cut -d"=" -f2| cut -d"," -f1)
if
then
Dest=$UNX/$u_product_path/$u_study_path/$UNXTR/$t2
break;
... (4 Replies)
Dear Friends,
I am trying to get a script in c-shell working but no way! I don't know why but on my mac was working and now on linux is not!
Basically the script should accept a root_file_name and work in batch on files. This is the script:
#!/bin/csh -fn
setenv IMAGIC_BATCH 1
... (3 Replies)
I tried to use the wildcard '*' in my bash script, but I can not get it work. Here is a simple example (list file names in current directory):
ls ./*
does not work in my bash script. But it works if I use
ls ./
So is there any special syntax to use '*' wildcard in bash script (I tested the... (11 Replies)
Had any one made the wildcard "*" or "?" work in tcp wrappers configure file hosts.allow and hosts.deny in AIX? It won't work for me no matter how hard I try.
I am trying to restrict the access of our ftp server and if I specify following in hosts.allow:
ftpd : host01.domain.com... (0 Replies)
Hi,
I'm using FreeBSD 6. I want to know which Shell I'm using. So I gave the command:
-sh-3.1$ ps -p $$
PID TTY TIME CMD
15547 pts/1 00:00:00 sh
Which shell is "sh"? Is it C Shell or Bourne Shell or Korn Shell?
Also, are Bourne & Korn shell one and the same or are... (4 Replies)
Hello all,
Any idea how to check whether a variable holding null value or not. if -z option works fine in bash, where as it is not working in sh.
bash-3.00$ sh
$ TEST=
$ if ; then
> echo "Null"
> else
> echo "Not null"
> fi
sh: test: 0403-004 Specify a parameter with this command.... (2 Replies)
hi freinds,
i just learning shell programming. i usually work in bash shell, but when i need tcshell, i normally i/p chshell command and go there. but although i have installed all the neccessay patches for this shell my machine can not work in tshell. but it shows the shell to be present..... (0 Replies)
I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days...
The structure of the paths are like this:
/home/domains/www.domain2.com/tgp/
/home/domains/www.domain3.com/tgp/... (1 Reply)