Here is the command syntax. The format "name:/jsmith/" is literal and cannot be changed.
search -l "name:/jsmith/"
search -l "name:/jsmi.*/"
I am trying to create a bash alias that will take a command line variable ($1) as input like below:
alias new_search='search -l "name:/$1/"'
So the new search command would simply be:
new_search jsmith
new_search jsmi.*
Obviously the alias above is incorrect.
I understand that escape character helps preserving (" and /) and I also searched online and made some progress but the syntax below still fails.
alias new_search='search -l \"name:\/$1\/\"'
Any suggestions? Thanks!
- Here is a reference I found: How to use an environment variable inside a quoted string in Bash