Skip to content

Instantly share code, notes, and snippets.

@lheckemann
Created January 28, 2019 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lheckemann/df2a7cf0b07983ceab27636b8e654045 to your computer and use it in GitHub Desktop.
Save lheckemann/df2a7cf0b07983ceab27636b8e654045 to your computer and use it in GitHub Desktop.
[linus@bringtnix:~/nixpkgs]$ a=helloworld
[linus@bringtnix:~/nixpkgs]$ echo "${a/low/high/}"
helhigh/orld
[linus@bringtnix:~/nixpkgs]$ echo "${a/low/high}"
helhighorld
[linus@bringtnix:~/nixpkgs]$ echo "${a/l?w/high}"
helhighorld
[linus@bringtnix:~/nixpkgs]$ echo "${a/"l?w"/high}"
helloworld
[linus@bringtnix:~/nixpkgs]$ pat="l?w"
[linus@bringtnix:~/nixpkgs]$ echo "${a/"$pat"/high}"
helloworld
[linus@bringtnix:~/nixpkgs]$ echo "${a/$pat/high}"
helhighorld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment