Skip to content
Advertisement

Tag: wildcard

Excluding a file extension through wildcards

I have a directory which files with multiple extensions such as *.asc, .txt..csv etc. I am using this path in a script where I can only change the file names, which is passed through variable. I can pick all the .csvs by passing *.csv as the variable value or *.txt for respective files. However what I want to do is

How to pass an extra option in ls using execv()?

I’m trying to execute this simple command ls -1 *.c using the execv() function. The output I’m getting is Answer There’s a big problem in your code: execv can’t tell how big the array you’re passing it is. You absolutely need a terminating NULL element to mark the end: OK, now that we have a valid execv invocation, we can

Bash: Using filenames as commands with the wildcard

I was playing around in my terminal earlier and discovered that I can execute single word commands (‘ls’,’cat’,’python2.7′,’exit’) by making a file or directory named the same thing as the command. However, I can’t execute ‘multi-word’ commands (‘rm -rf *’,’ls -a’, ‘python2.7 test.py’) (which also led me to discover that you can’t remove directories named ‘-rf’ with ‘rm -rf *’)

bash wildcard n digits

So I’ve got the following files in the tmp directory: if I wanted to list only the files that end in ‘.digits’ (0, 1, 22, 4444) but not (t9) I could try and use wildcards such as this: however I get the following results with the ugly error I’ve also tried using {0..999} but that also results in the same

Advertisement