I have 2 files each in user/admin/1/2/[a-c] subdirectories. The files are preQC_1.txt and preQC_2.txt - both of which will be inputs in my tool.I use ${f##*/} for preQC_1.txt in my for loopfor f in ~/1/2/*/*_1.txt; do exptool input1= ${f##*/} input2= {$f%_1.txt}_2.txtMy program says that file '{$f%_1.txt}_2.txt' and I am 100% sure I am incorrectly using parameter expansion. For input2, how can I make sure I am ONLY getting the 'preQC_2.txt' (filename+extension without the directory listing)?EDIT: I've tried combining ${f##*/} and {$f%_1.txt}_2.txt but that actually expands to 'user/admin/1/2/a/preQC_1.txt_2.txt'
Parameter expansion question
bash;scripting;macintosh
for f in ~/1/2/*/*_1.txt; do    file_without_path=${f##*/}    exptool input1= ${file_without_path} input2= ${file_without_pathf%_1.txt}_2.txtdone