From the course: Linux: Shells and Processes

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Extended glob exercise

Extended glob exercise - Linux Tutorial

From the course: Linux: Shells and Processes

Extended glob exercise

- We'll be running these commands in our glob files directory. Again, for me, that is in /home/user1/Exercisefiles/Ch01/, for chapter one, /globfiles. Let's do something standard globs can't do. Let's create two patterns matching the beginning and the end of a file name. And then group that together and invert it. Type in ls space -d space ! left parenthesis @ left parenthesis photo|video right parenthesis *@ left parenthesis .jpg|.png right parenthesis right parenthesis. Take a moment to visualize what this will show. When done press enter. Is the output what you expected? At first glance, it may look like this would not list any files that start with photo or video, or end with .jpg or .png. But we see files in our output that start with video and photo. So what's going on? Let's analyze this extended glob. Our first pattern matches the word photo or the word video and specifies that exactly one has to be…

Contents