Skip to main content
10 votes
Accepted

What does '\($*\)' mean in sed regular expression in a makefile?

The $ used here is the dollar sign of the $* automatic Make variable, not something that denotes the end of line. You have a similar example of this in the replacement part of the sed substitution, ...
Kusalananda's user avatar
  • 339k
6 votes

What does '\($*\)' mean in sed regular expression in a makefile?

It's important to keep in mind that normally regular expressions given on the command line to sed are subject to two rounds of parsing: once by sh (which is why you put in in ' quotes), and again by ...
Martin Kealey's user avatar
4 votes
Accepted

How do quotes work in bash regex regarding reserved characters?

Short answer: yes, of course you need to quote Bash special characters in a regex. Longer answer, as well as an idea to overcome the problem of quoting Bash special characters, is contained in section ...
Vilinkameni's user avatar
  • 1,209
3 votes
Accepted

Taking only a four-digit number as user input

Most shells have builtin support for glob pattern matching, few have builtin support for regular expression pattern matching. With standard sh syntax, using glob pattern matching via the case ...
Stéphane Chazelas's user avatar
2 votes

How do quotes work in bash regex regarding reserved characters?

It's safe to put any character except ^ or \ inside a bracket expression to make it literal (i.e. change x to [x]) but never put a \ in front of any character that isn't a metacharacter (e.g. the /s ...
Ed Morton's user avatar
  • 32.4k
1 vote

What regex should I use to get inotifywait --include to trigger upon the creation of a file with a known fixed filename?

Despite inotifywait --format %f printing hello.txt, that it NOT what it thinks is the filename. What it thinks is the filename is ./hello.txt. Hence the correct regex is ^\./hello\.txt$: inotifywait -...
jaimet's user avatar
  • 418

Only top scored, non community-wiki answers of a minimum length are eligible