Using BASH redirects and "prompt" files to interact with commands/scripts ??
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
example in a text like 'a ab abc abcd', the cmd's for loop can do selecting a, or just ab abc, or all but not a. and many other things without using a program like cut.
it can also skip lines, have custom delimeters and eol, do some variable expansion like remove quotes, show pathname only, show filename only, drive letter only... many others more.
like bash for's (( ; ; )), the cmd's for also have for /l
i guess it's something like we can call.. a merged tool of bash's for and cut with some more parsing.
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
Interesting. Though, as I remember, power tools are behind syntax forest. Maybe it's an idea to have a more powerful builtin. (Too bad it can't be just shell function)
In addition to what konsolebox said about splitting the text, this can also be applied to files with /F, which allows you to do some reasonably complicated processing. For example, you can use REG to dump registry keys to a file and then process them one by one. Delayed expansion is another feature that is very useful but usually overlooked. For the best details on what CMD can do, check FOR /?, SET /?, CMD /?, and SETLOCAL /?. A shame there is no simple 'man cmd'
Interesting. Though, as I remember, power tools are behind syntax forest. Maybe it's an idea to have a more powerful builtin. (Too bad it can't be just shell function)
nah i don't want a heavy function included in the bash shell. that will just make things slower.
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
Well, if you don't use it, it just increases executable size. Not that it will have a great impact (600K already). If you use it, it replaces writing logic in bash - and gives speed.
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
Ha. Very funny. No extensions. Not one. 'caller' builtin was in POSIX forever. And surely no omissions.
OK, I don't ask in bash, only in Zsh.
Seriously, bash has extensions. I don't think the mentioned builtin should mimic windows shell behavior (which is not suitable for complex commands), but it could be comparable in power.
But as I'm too lazy to write such a builtin for zsh, it's only theory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.