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.
how do I write a workable script that demonstrates that variable expansion occurs before pathname expansion. Can someone help me, I don't know where or how to start.
Sounds suspiciously like homework. Have you tried googling for any of this? If it is in fact homework one would think you have probably already been instructed and so it is
in notes somewhere.
Sounds suspiciously like homework. Have you tried googling for any of this? If it is in fact homework one would think you have probably already been instructed and so it is
in notes somewhere.
Well in your example 'a' is a variable and '?' is being used by the shell to expand into any single character. So I believe this gives you exactly the information you require to answer your question.
Well in your example 'a' is a variable and '?' is being used by the shell to expand into any single character. So I believe this gives you exactly the information you require to answer your question.
so without the question mark g would not expand, and this would cause only g8 to show in the output. Is this correct?
Shell operations, including their order is explained here. "Not a lot of people know that"! But it is key to a full understanding of how bash works. Time for bed now; will answer your specific question -- if not answered already -- tomorrow,
$ ls g This command would list all files that contain g Is this correct?
markush's response is the correct one here. Try it for yourself and see what happens. Create three files starting with the letter g and see what
happens when you issue the command.
$ ls g This command would list all files that contain g Is this correct?
No. Actually that command will only list a file or directory named "g", if exists. You need to use wildcards in your command so the shell expands them.
Have a look at the bash manpage, section EXPANSION. You'll find there the types of expansion the shell performs, and their explanation.
@kenny53067, it seems you're posting from a Windows-computer. If you don't have Linux running, you should either boot a live-CD or use for example Virtualbox and install a Linux-distribution as a virtual machine. Then you can try out the code.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.