Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm having a retard moment and I can't figure this out. I have a list of files listed in a error.txt file that I'm trying to copy in a tiny script, but it's doing something and I can't figure out why!
I can echo the file listed:
Code:
[root@testmachine1 rpm_repo]# cat ../error2.txt | awk '{print "echo The filename is "$1}' | bash
The filename is NetworkManager-0.7.0-10.el5_5.2.x86_64.rpm
What doesn't work is when I try and move that file. That file is exactly where the file is showing it, but I keep getting an error saying it ISN'T there.
Code:
[root@testmachine1 rpm_repo]# cat ../error2.txt | awk '{print "ls ../yum/rhel/5/base/"$1}' | bash
: No such file or directoryorkManager-0.7.0-10.el5_5.2.x86_64.rpm
I know it's something simple but I just can't see it. What am I doing wrong? My paths are right, the file is there...my command isn't being interrupted correctly for some reason.
I suspect a special character in your original file. Notice your output doesn't list the name of the file you expect but rather:
Quote:
No such file or directoryorkManager-0.7.0-10.el5_5.2.x86_64.rpm
Try running a "cat -v" on the original file and see if there is a backspace (^H) or something else showing up in the file.
Also you don't have to cat and pipe to awk - you can run your awk on the file itself:
Code:
awk '{print "echo The filename is "$1}' ../error2.txt | bash
By the way - what are you trying to do piping it to bash? An rpm isn't an executable but rather a package so you'd need to operate on the file using the rpm command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.