Computing.Net > Forums > Unix > Passing incomplete filenames

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Passing incomplete filenames

Reply to Message Icon

Name: chris
Date: October 8, 2003 at 16:16:55 Pacific
OS: unix
CPU/Ram: -
Comment:

Is it possible to pass a filename without knowing it's full name?

I want to write some generic code that will call a script with two filenames, from within a wrapper file.

i.e script_1.ksh <filename> <filename>

The filenames will have a standard format
system name, padding, date, padding and run id.

The run id will be passed into the wrapper file as a parameter, so the filenames will look something like this;

OUTPUTxxx091003xxOOO1.DAT.

I am uninterested in the date component, as the run id will always be unique

I want to automate the process as much as possible, requiring that the user need only enter the wrapper script name and a run id to perform some verification.

Any thoughts much appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: WilliamRobertson
Date: October 9, 2003 at 16:26:26 Pacific
Reply:

If you specify a wildcard when calling the script, then the shell will expand it first (if it can) and the called script will only see the expanded list. Alternatively the script could determine the set of matching filenames itself according to some rules.

It could be worth reading up on shell wildcards as you can build some quite detailed expressions, e.g. in ksh

test+([1-3]).???

matches test1.dat but not test1.html, test2.dat or test.doc.


0
Reply to Message Icon

Related Posts

See More


Unix or perl script AIX 4.3.3 to AIX 5.2



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Passing incomplete filenames

passing a filename to vi ?? www.computing.net/answers/unix/passing-a-filename-to-vi-/5813.html

Read File name and pass to SQLoader www.computing.net/answers/unix/read-file-name-and-pass-to-sqloader/5543.html

passing variable to ftp www.computing.net/answers/unix/passing-variable-to-ftp/5085.html