I have a shell script , the content is below , the script will attach a file /tmp/attach.txt to the mail and send it out .
CHR=`cat file.txt |head -10 |cut -c 2-7`
mail -a /tmp/attach.txt email_address
Now , if I would like to add one checking , if the content of $CHR is begins with A ( eg. A12345 ) , then change attach file name ( from attach.txt to A123456.txt ) , so that the user see the attach file name is A123456.txt , if not begins with A , then continue to use the file name attach.txt as the attach file name .
Can advise what can I do ?
Last edited by ust; 09-25-2012 at 03:27 AM.