Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line Argument Usage - ksh script

Status
Not open for further replies.

tbohon

Programmer
Apr 20, 2000
293
US
I need to be able to enter a date (MMDD) on the command line and, within the ksh script, use that value to build a file name for zcat.

Example: if the date I want is 1217, I'd want to enter

. dailyrec.ksh 1217

on the command line and then call zcat with something like

zcat /u/work/filename_MMDD.dbg > newfileMMDD.err

I've tried various and sundry things but have hit a (mental) wall - I'm sure I'll be embarassed when I learn how simple this is to do but, at my advanced age, being embarassed isn't the worst thing that can happen to you ... :)

Thanks in advance for the assist.

Tom
 
Code:
zcat /u/work/filename_${1}.dbg > newfile${1}.err

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
In the ksh man page pay attention to positional parameters.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I stand in awe ... I had tried every combination I could think of last week without success ... in 2 minutes the script is working perfectly.

Thanks to both of you!

Now on to emailing error messages or the results of the script and checking for a command line argument ... this is going to be one of those scripts that is 'in work' for weeks or months as I think of new, neat things to do.

Have a great day!

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top