I have inherited a script (ksh) - which requires an input file and location to be specified on the command line.....
i.e runsc MRG_060601 ../input_files/
I am trying to tidy this up by using an env variable for the location (as it is always the same) - but it will still require the name of the input file to run.
There are two things I want to do:
1. I want to be able to run multiple files from within the $LOAD
directory (my new env variable)...i.e runsc $LOAD/*
Should I do this with a for loop? Or is there a prettier way?
2. I want to write an auto-complete function that reads each character as it is entered and scans the $LOAD dir to see if it can finish the filename. (similar to bash).
So I could just type "runsc" - then when prompted start by typing..."MR" and the line would be completed for me if there was only one thing it could be - or completed as far as possible if there are multiple matches with different endings.
I imagine this is a single character read type thing - but i don't want to go to the hassle of writing a convoluted script if there is a function existing - or a nice tody method.
Full or part answers appreciated.