I would be very surprised if the command:
filename=INPUT_GIANT_*csv
ever did what you think it did. If you type in that command manually at a terminal while sitting in a directory where one file matching that pattern exists and immediately follow that command with the command:
printf 'filename: %s\n' "$filename"
I think you'll find that it prints:
filename: INPUT_GIANT_*csv
while the command:
printf 'filename: %s\n' $filename
(with the double quotes removed), prints:
filename: INPUT_GIANT_XXXcsv
where XXX is the string matched by the asterisk in your filename matching pattern.
You haven't shown us what your script does with the variables file
, filename
, and GIANT_MONYYYY
other than the one place that $filename
is expanded while setting the variable GIANT_MONYYYY
. Without seeing how those variables are used in the rest of your script, it is hard to guess at what might be wrong.
With what you have shown us, it is hard to guess at why your script would work on a UNIX system (other than a Solaris/SunOS UNIX system) if you were using a Korn shell or a bash shell on both your UNIX system and on your Linux system.
What UNIX operating system were you using and what Linux system are you using now?
What shell were you using on the UNIX operating system and what shell are you using on your Linux system now?
Please show us your complete script as it was when it worked on the UNIX system you were using and please show us the complete script as it now appears on your Linux system.
Note that the error message you are getting is saying that when you run the command:
tr '\r' '\n' < INPUT_GIANT_*.csv | grep -v '^$' > INPUT_GIANT.csv
the pattern INPUT_GIANT_*.csv
is not matching any existing file. Note also that the pattern used here is not the same pattern that was assigned to the variable filename
. (One ends in .csv
while the other one ends in csv
(without the <period> character.) There is nothing in the command that is failing that refers to any variable. So, why do you think an expansion of the variable filename
is your problem? (Or, did you not show us the first 8 lines of the script named debug_GST.sh
?)
What output do you get from the command:
ls -l /home/edwh_test/S13018/EDWH-DMT03/stgdata/RPT/INPUT_GIANT*
at a time when debug_GST.sh
fails with the diagnostic you showed us in post #1 in this thread?