#cat a
BAC064DAL
BAC063DAL
BAC056PHX
BAC066DAL
BAC062PHX
BAC062DAL
BAC060DAL
BAC058PHX
BAC054PHX
BAC051PHX
[root]# for i in `cat a`
> do
> tar xvf $a/$a*.tar*
> done
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[root@logserver logger]#
As you see, the program tar is telling you that it can not find any file with such name.
What name is that?
Whatever this expands to $a/$a*.tar*
Which in this case is pretty much garbage since the variable $a
does not exist, in your code.
Assuming you want to extract all those files in the file a:
#cat a
BAC064DAL
BAC063DAL
BAC056PHX
BAC066DAL
BAC062PHX
BAC062DAL
BAC060DAL
BAC058PHX
BAC054PHX
BAC051PHX
while read f; do tar xvf /path/to/"${f}".tar; done < a
Replace /path/to
with the directory path you need and fix the extension of the file if it is a tar.
Try replacing "$a" with "$i".
Can you please elaborate what exactly is your requirement here