Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created December 1, 2009 09:13
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 scottwb/246177 to your computer and use it in GitHub Desktop.
Save scottwb/246177 to your computer and use it in GitHub Desktop.
String replacement in a string var in bash.
#!/bin/sh
# Shows how to do replacment in a string variable in bash.
SRC_STRING=/Applications/something
REPLACED_STRING=${SRC_STRING//\//\\/}
echo "Source String is: $SRC_STRING"
echo "Replaced String is: $REPLACED_STRING"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment