ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Why does echo HelloWorld > * work when I do it from the command line, but when I put it in a script I get an ambiguous redirect error? To clarify I'm redirecting this to 1000 empty files.. Thanks in advanced!
Last edited by justmy2cents; 07-25-2017 at 04:46 PM.
Does it work from an interactive shell (i.e. command line)? You should double check that, I do not think that is correct.
You can do that using the tee command with a glob, but I would suggest using find to generate the list of target files with -exec or xargs would be much safer.
Yeah it works perfectly from the CLI.. I think it has to do with too many open file descriptors, but nevertheless thanks the suggestions ill try em out.
Last edited by justmy2cents; 07-25-2017 at 04:54 PM.
The machine im trying this on has Xubuntu with the Z shell.
Then perhaps you should change the title of your question: Bash: ambiguous redirect, as that really increases the ambiguity index!
I am not a zsh user but I see that it does support multiple redirection with a MULTIOS flag. That is not a common shell feature and does not work in Bash, or any other shells I am familiar with.
Please try to keep your question contexts accurate.
Last edited by astrogeek; 07-25-2017 at 05:32 PM.
Reason: typos - added original quote context, additional comment.
You can do that using the tee command with a glob, but I would suggest using find to generate the list of target files with -exec or xargs would be much safer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.