common/autoconf/configure
changeset 22729 ef9f87d39598
parent 22727 7d0c85ad2eec
child 24655 6940eba5402c
equal deleted inserted replaced
22728:0a9d96bf2023 22729:ef9f87d39598
   125 # Returns a shell-escaped version of the argument given.
   125 # Returns a shell-escaped version of the argument given.
   126 function shell_quote() {
   126 function shell_quote() {
   127   if [[ -n "$1" ]]; then
   127   if [[ -n "$1" ]]; then
   128     # Uses only shell-safe characters?  No quoting needed.
   128     # Uses only shell-safe characters?  No quoting needed.
   129     # '=' is a zsh meta-character, but only in word-initial position.
   129     # '=' is a zsh meta-character, but only in word-initial position.
   130     if echo "$1" | grep -qE '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$' \
   130     if echo "$1" | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\.:,%/+=_-]\{1,\}$' > /dev/null \
   131         && ! echo "$1" | grep -qE '^='; then
   131         && ! echo "$1" | grep '^=' > /dev/null; then
   132       quoted="$1"
   132       quoted="$1"
   133     else
   133     else
   134       if echo "$1" | grep -qE "[\'!]"; then
   134       if echo "$1" | grep "[\'!]" > /dev/null; then
   135         # csh does history expansion within single quotes, but not
   135         # csh does history expansion within single quotes, but not
   136         # when backslash-escaped!
   136         # when backslash-escaped!
   137         local quoted_quote="'\\''" quoted_exclam="'\\!'"
   137         local quoted_quote="'\\''" quoted_exclam="'\\!'"
   138         word="${1//\'/${quoted_quote}}"
   138         word="${1//\'/${quoted_quote}}"
   139         word="${1//\!/${quoted_exclam}}"
   139         word="${1//\!/${quoted_exclam}}"