Skip to content

Instantly share code, notes, and snippets.

@weaver299
Last active September 5, 2018 16:19
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 weaver299/d8d83b4b406f8b2abeb01f1194a928b1 to your computer and use it in GitHub Desktop.
Save weaver299/d8d83b4b406f8b2abeb01f1194a928b1 to your computer and use it in GitHub Desktop.
Can't output desired string with "..." in bash??
#!/usr/bin/env bash
# This outputs "\$conf" as desired
echo $'s/^(\\$conf\\[\'simplesamlphp_auth_installdir\'\\] = .*)/if(whatever){ $1 } else { whatever };/'
# Yes, it can also be done with this craziness
echo 's/^(\$conf\['"'"'simplesamlphp_auth_installdir'"'"'\] = .*)/if(whatever){ $1 } else { whatever };/'
# But it doesn't seem to be possible with "..." ?
echo "s/^(\$conf\['simplesamlphp_auth_installdir'\] = .*)/if(whatever){ \$1 } else { whatever };/"
echo "s/^(\\$conf\['simplesamlphp_auth_installdir'\] = .*)/if(whatever){ \$1 } else { whatever };/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment