Skip to main content

All Questions

0 votes
0 answers
8 views

Regex command line argument is expanded [duplicate]

I am trying to pass a regex pattern as an argument to my script as follows: bash script.sh '[a-z]*[0-9]*' in my script I am assigning it to a variable FIRST_ARG=$1 using echo $FIRST_ARG results in ...
Yoh's user avatar
  • 1
1 vote
2 answers
411 views

How to introduce support for command line options in a script that is written to use positional arguments?

I have a script that is currently used with positional arguments, like this: ./script.sh fname lname address I want to also support ordinary command line options when I call this script, so that I ...
Ferenc's user avatar
  • 113
1 vote
2 answers
4k views

How to grep command line argument on which RegEx has been applied?

I'm trying to write a script that takes as input a set of integers representing certain /dev/sda's. For example, if the command line arguments are 3 & 5, the output will show the UUID for /dev/...
Somenath Sinha's user avatar
4 votes
1 answer
166 views

Selecting non-existent files with wildcard/regex

I'm trying to convert hundreds of *.jpg files to *.webp files with libwebp on macOS. Particularly, I want to use the command line tool cwebp to perform the conversion. It works like this: cwebp <...
nalzok's user avatar
  • 431
2 votes
2 answers
4k views

Find files with extensions given in arguments using regex

Let's say a have a following command search /home/user proc .h .c .txt ... I am building a script with find command to get all files that start with given name and end with one of given extensions. ...
Dandry's user avatar
  • 187