common/autoconf/configure
changeset 22727 7d0c85ad2eec
parent 22725 c382bed20726
child 22729 ef9f87d39598
equal deleted inserted replaced
22726:d984085c5ff2 22727:7d0c85ad2eec
   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 [[ "$1" =~ ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$ && ! "$1" =~ ^= ]]; then
   130     if echo "$1" | grep -qE '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$' \
       
   131         && ! echo "$1" | grep -qE '^='; then
   131       quoted="$1"
   132       quoted="$1"
   132     else
   133     else
   133       if [[ "$1" =~ [\'!] ]]; then
   134       if echo "$1" | grep -qE "[\'!]"; then
   134         # csh does history expansion within single quotes, but not
   135         # csh does history expansion within single quotes, but not
   135         # when backslash-escaped!
   136         # when backslash-escaped!
   136         local quoted_quote="'\\''" quoted_exclam="'\\!'"
   137         local quoted_quote="'\\''" quoted_exclam="'\\!'"
   137         word="${1//\'/${quoted_quote}}"
   138         word="${1//\'/${quoted_quote}}"
   138         word="${1//\!/${quoted_exclam}}"
   139         word="${1//\!/${quoted_exclam}}"