help- wildcard not working in shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help- wildcard not working in shell
# 8  
Old 05-09-2011
Do you have execute permissions on that directory?
Can you post output of
Code:
ls -dl ${AI_LANDING}

# 9  
Old 05-09-2011
Quote:
Originally Posted by mirni
Do you have execute permissions on that directory?
Can you post output of
Code:
ls -dl ${AI_LANDING}

This is the output

drwxr-xr-x 14 userid etl 28 May 9 05:05 .

What does this say about the permission

---------- Post updated at 05:15 AM ---------- Previous update was at 05:11 AM ----------

Quote:
Originally Posted by mirni
Do you have execute permissions on that directory?
Can you post output of
Code:
ls -dl ${AI_LANDING}

Only having trouble while using wildcard. The results are correct when the filename is used.
# 10  
Old 05-09-2011
I believe you need execute permissions on the dir to perform tests on files inside. You have both r and x perms, so that's ok.
Please see my previous post and look at your test file abc<>. It's not empty, or?

Last edited by mirni; 05-09-2011 at 07:27 AM..
# 11  
Old 05-09-2011
Quote:
Originally Posted by spirit10
Hi,

I tried the above code but it is still not finding the file at the directory..This is the output I get

* Unix file permissions may prevent an accurate summation of reported data.
/abc*: No such file or directory
Hi,

This code worked and is able to identify files starting with abc Smilie (I had made a mistake wid one of the variables while using your code earlier)

So now it is correctly identifying the presence of file..just one small thing

It gives the correct message when file exists, but when it does not exist the following default msg is displayed

* Unix file permissions may prevent an accurate summation of reported data.
landingpath/abc*: No such file or directory

instead of our message which should display

File '$src_filename1' was not found or has not a size greater than zero"

---------- Post updated at 05:39 AM ---------- Previous update was at 05:38 AM ----------

Quote:
Originally Posted by mirni
I believe you need execute permissions on the dir to perform tests on files inside. You have both r and x perms, so that's ok.
Please see my previous post and look at your test file abc<>. It's not empty, or?
Filesize is greater than zero. Can u see my latest post..
# 12  
Old 05-09-2011
Quote:
File '$src_filename1' was not found or has not a size greater than zero"
OK. But that's what it says:
Code:
landingpath/abc*: No such file or directory

If there are no files inside the dir, shell does not expand the asterisk, and so your variable src_filename1 will contain 'landingpath/abc*'. And there is no such file...
just try this:
Code:
$ for i in nonexistingdir* ; do echo $i ; done
nonexistingdir*

That "Unix permissions " warning is odd... but I wouldn't worry about it too much. It says, your numbers will be off, if you are testing files that you can't read.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cp not working in shell script but running perfectly from shell

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)
Discussion started by: yadavricky
4 Replies

2. Shell Programming and Scripting

C-Shell!! Please help...cannot get it working...

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)
Discussion started by: Mandrake83
3 Replies

3. Shell Programming and Scripting

What does " shell wildcard " shell script?

Hi, I just wondering what does " shell wildcard " Thank (1 Reply)
Discussion started by: guidely
1 Replies

4. Shell Programming and Scripting

wildcard in bash shell script

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)
Discussion started by: aerosols
11 Replies

5. AIX

wildcard not working in /etc/hosts.allow

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)
Discussion started by: cypher4066
0 Replies

6. Shell Programming and Scripting

shell script is not working..

Dear all, I am writing simple shell script. #/bin/bash ORACLE_HOME=/home/app/oracle/product/9.2.0 export ORACLE_HOME export ORACLE_SID=DATX $ORACLE_HOME/bin/sqlplus -s datadmin/password <<EOF execute testproc; exit; EOF ~ ~ In the above shell script, the oracle instance name is... (2 Replies)
Discussion started by: govindts
2 Replies

7. Shell Programming and Scripting

Which Shell I'm working?

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)
Discussion started by: freephoneid
4 Replies

8. Shell Programming and Scripting

if -z not working in SH shell

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)
Discussion started by: rijeshpp
2 Replies

9. Shell Programming and Scripting

shell not working

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)
Discussion started by: hytechpro
0 Replies

10. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

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)
Discussion started by: Neko
1 Replies
Login or Register to Ask a Question