Skip to content
This repository
Browse code

escaped cat avoids alias

  • Loading branch information...
commit 52264235369c9b96c883101ed629f78109ce2293 1 parent c503718
Curtis J Schofield authored
2  binscripts/rvm-installer
@@ -525,7 +525,7 @@ case "${version}" in
525 525
 
526 526
   (latest-minor)
527 527
     echo "${version}" > "$rvm_path/RELEASE"
528  
-    version="$(cat "$rvm_path/VERSION")"
  528
+    version="$(\cat "$rvm_path/VERSION")"
529 529
     install_release $(fetch_version "${version%.*}") || exit $?
530 530
     ;;
531 531
 
2  scripts/alias
@@ -171,7 +171,7 @@ alias_list() {
171 171
   typeset item
172 172
   case "${alias_name}" in
173 173
     (names)
174  
-      cat - # just show it
  174
+      \cat - # just show it
175 175
       ;;
176 176
     (*)
177 177
       while
2  scripts/cli
@@ -870,7 +870,7 @@ Error:
870 870
     unset rvm_rvmrc_files
871 871
   fi
872 872
 
873  
-  disk_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
  873
+  disk_version="$(\cat "$rvm_path/VERSION") ($(\cat "$rvm_path/RELEASE" 2>/dev/null))"
874 874
   if
875 875
     [[ -s "$rvm_path/VERSION" &&
876 876
       "${rvm_version:-}" != "${disk_version:-}" &&
2  scripts/cron
@@ -43,7 +43,7 @@ __rvm_cron_command()
43 43
 
44 44
 __sm.cron.show()
45 45
 {
46  
-  EDITOR=cat crontab -e 2>/dev/null
  46
+  EDITOR=\cat crontab -e 2>/dev/null
47 47
 }
48 48
 
49 49
 __sm.filter.remove.group()
4  scripts/env
@@ -11,9 +11,9 @@ then
11 11
 elif
12 12
   [[ "$rvm_cron_flag" == "1" || "$*" =~ "--cron" ]]
13 13
 then
14  
-  cat "$environment_file_path" |
  14
+  \cat "$environment_file_path" |
15 15
     GREP_OPTIONS="" \grep -Eo "[^ ]+=[^;]+" |
16 16
     sed -e 's/\$PATH/'"${PATH//\//\/}"'/' -e 's/\${PATH}/'"${PATH//\//\/}"'/'
17 17
 else
18  
-  cat "$environment_file_path"
  18
+  \cat "$environment_file_path"
19 19
 fi
2  scripts/external
@@ -31,7 +31,7 @@ external_grep_existing()
31 31
   then
32 32
     GREP_OPTIONS="" \grep -vE "${existing[*]}" -
33 33
   else
34  
-    cat -
  34
+    \cat -
35 35
   fi
36 36
 }
37 37
 
4  scripts/extras/rails
@@ -121,14 +121,14 @@ rails_routes()
121 121
   md5_current=${md5%% *}
122 122
 
123 123
   if [[ -s "$cache_file" && -s "$cache_file.md5" ]]; then
124  
-    md5_cached=$(cat -v "${cache_file}.md5")
  124
+    md5_cached=$(\cat -v "${cache_file}.md5")
125 125
     md5_cached=${md5%% *}
126 126
   else
127 127
     md5_cached=""
128 128
   fi
129 129
 
130 130
   if [[ -s "$cache_file" && $md5_current == $md5_cached ]]; then
131  
-    routes=$(cat -v "$cache_file")
  131
+    routes=$(\cat -v "$cache_file")
132 132
   else
133 133
     routes=$(rake routes 2>/dev/null)
134 134
     if [[ $? -gt 0 ]]; then
4  scripts/functions/benchmark
@@ -14,7 +14,7 @@ __rvm_benchmark()
14 14
 
15 15
   unset code
16 16
 
17  
-  cat $rvm_ruby_file >> "${rvm_tmp_path}/$$.rb"
  17
+  \cat $rvm_ruby_file >> "${rvm_tmp_path}/$$.rb"
18 18
 
19 19
   printf "%b" "\n end \nend\n" >> "${rvm_tmp_path}/$$.rb"
20 20
 
@@ -27,7 +27,7 @@ __rvm_benchmark()
27 27
   if [[ ${rvm_debug_flag:0} -gt 0 ]] ; then
28 28
 
29 29
     printf "%b" "\n${rvm_tmp_path}/$$.rb:\n\
30  
-      $(cat ${rvm_tmp_path}/$$.rb)"
  30
+      $(\cat ${rvm_tmp_path}/$$.rb)"
31 31
 
32 32
   fi
33 33
 
2  scripts/functions/build
@@ -167,7 +167,7 @@ __rvm_update_configure_opt_dir_flags()
167 167
 {
168 168
   typeset __enable_rpath __lib_path
169 169
   if
170  
-    which bash | xargs head -n 1 | cat -e | \grep -b '^^?ELF' >/dev/null
  170
+    which bash | xargs head -n 1 | \cat -e | \grep -b '^^?ELF' >/dev/null
171 171
   then
172 172
     __enable_rpath="true"
173 173
   fi
2  scripts/functions/build_config
@@ -387,7 +387,7 @@ __rvm_detect_max_threads()
387 387
       fi
388 388
       ;;
389 389
     (*)
390  
-      cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l
  390
+      \cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l
391 391
       ;;
392 392
   esac
393 393
 }
2  scripts/functions/env
@@ -194,7 +194,7 @@ __rvm_unload_action()
194 194
   typeset -a _list
195 195
 
196 196
   IFS=$'\n'
197  
-  _list=( $( cat ${2:--} | sort -u ) )
  197
+  _list=( $( \cat ${2:--} | sort -u ) )
198 198
   for _element in "${_list[@]}"
199 199
   do $1 "${_element}"
200 200
   done
2  scripts/functions/group
@@ -43,7 +43,7 @@ __rvm_list_all_users()
43 43
       dscl . -search /Users PrimaryGroupID 20 | GREP_OPTIONS="" \grep PrimaryGroupID | cut -f 1
44 44
       ;;
45 45
     *)
46  
-      GREP_OPTIONS="" \grep -xF -f <(cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)
  46
+      GREP_OPTIONS="" \grep -xF -f <(\cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)
47 47
       ;;
48 48
   esac
49 49
 }
2  scripts/functions/installer
@@ -1006,7 +1006,7 @@ setup_etc_bashrc()
1006 1006
     [[ -f "${new_content_path}" ]] || \rm -f "${new_content_path}"
1007 1007
     {
1008 1008
       print_etc_bashrc_change # prepend
1009  
-      cat "${system_bashrc_file}"
  1009
+      \cat "${system_bashrc_file}"
1010 1010
     } > "${new_content_path}" &&
1011 1011
     \mv "${new_content_path}" "${system_bashrc_file}"
1012 1012
   fi
6  scripts/functions/logging
@@ -100,8 +100,8 @@ rvm_debug_stream()
100 100
 {
101 101
   (( ${rvm_debug_flag:-0} || ${rvm_trace_flag:-0} )) || return 0
102 102
   if rvm_pretty_print stdout
103  
-  then cat - | awk '{print "'"${rvm_debug_clr:-}"'"$0"'"${rvm_reset_clr:-}"'"}'
104  
-  else cat -
  103
+  then \cat - | awk '{print "'"${rvm_debug_clr:-}"'"$0"'"${rvm_reset_clr:-}"'"}'
  104
+  else \cat -
105 105
   fi >&2
106 106
 }
107 107
 rvm_log()
@@ -211,6 +211,6 @@ __rvm_table()
211 211
     echo "$1" | __rvm_table_wrap_text
212 212
   fi
213 213
   __rvm_table_br
214  
-  cat "${2:--}" | __rvm_table_wrap_text
  214
+  \cat "${2:--}" | __rvm_table_wrap_text
215 215
   __rvm_table_br
216 216
 }
2  scripts/functions/manage/macruby
@@ -97,7 +97,7 @@ macruby_install()
97 97
   binaries=(erb gem irb rake rdoc ri ruby testrb)
98 98
   for binary_name in ${binaries[@]}; do
99 99
     # TODO: This should be generated via an external script.
100  
-    ruby_wrapper=$(cat <<RubyWrapper
  100
+    ruby_wrapper=$(\cat <<RubyWrapper
101 101
 #!/usr/bin/env bash
102 102
 
103 103
 export GEM_HOME="\${GEM_HOME:-$rvm_ruby_gem_home}"
4  scripts/functions/rvmrc_project
@@ -153,11 +153,11 @@ __rvm_load_project_config()
153 153
       rvm_previous_environment="$(__rvm_env_string)"
154 154
       rvm_current_rvmrc="$1"
155 155
 
156  
-      rvm_ruby_string="$(cat "$1")"
  156
+      rvm_ruby_string="$(\cat "$1")"
157 157
       [[ -n "${rvm_ruby_string}" ]] || return 2
158 158
       if [[ -f "$(dirname $1)/.ruby-gemset" ]]
159 159
       then
160  
-        rvm_gemset_name="$(cat "$(dirname $1)/.ruby-gemset")"
  160
+        rvm_gemset_name="$(\cat "$(dirname $1)/.ruby-gemset")"
161 161
       fi
162 162
       rvm_create_flag=1 __rvm_use   || return 3
163 163
       # "$(dirname $1)/.rbenv-vars" ... can we support those without licensing ?
4  scripts/functions/rvmrc_trust
@@ -31,12 +31,12 @@ __rvm_sha256_for_contents()
31 31
 __rvm_checksum_for_contents()
32 32
 {
33 33
   typeset __sum
34  
-  __sum=$(  echo "$1" | cat - "$1" | __rvm_md5_for_contents   ) ||
  34
+  __sum=$(  echo "$1" | \cat - "$1" | __rvm_md5_for_contents   ) ||
35 35
   {
36 36
     rvm_error "Neither md5 nor md5sum were found in the PATH"
37 37
     return 1
38 38
   }
39  
-  __sum+=$( echo "$1" | cat - "$1" | __rvm_sha256_for_contents ) ||
  39
+  __sum+=$( echo "$1" | \cat - "$1" | __rvm_sha256_for_contents ) ||
40 40
   {
41 41
     rvm_error "Neither sha256sum nor shasum found in the PATH"
42 42
     return 1
2  scripts/functions/rvmrc_warning
@@ -68,7 +68,7 @@ __rvmrc_warning_list()
68 68
 {
69 69
   rvm_log "# List of project files that ignore warnings:"
70 70
   if [[ -s "$__rvmrc_warning_path" ]]
71  
-  then cat "$__rvmrc_warning_path"
  71
+  then \cat "$__rvmrc_warning_path"
72 72
   fi
73 73
 }
74 74
 
10  scripts/functions/utility
@@ -342,7 +342,7 @@ __rvm_version_compare()
342 342
 
343 343
 __rvm_pager_or_cat_v()
344 344
 {
345  
-  eval "${PAGER:-cat -v} '$1'"
  345
+  eval "${PAGER:-\cat -v} '$1'"
346 346
 }
347 347
 
348 348
 __rvm_ask_for()
@@ -362,8 +362,8 @@ __rvm_read_lines()
362 362
   IFS="
363 363
 "
364 364
   if [[ "${2:--}" == "-" ]]
365  
-  then eval "$1=( \$( cat - ) )"
366  
-  else eval "$1=( \$( cat \"\${2:--}\" ) )"
  365
+  then eval "$1=( \$( \cat - ) )"
  366
+  else eval "$1=( \$( \cat \"\${2:--}\" ) )"
367 367
   fi
368 368
 }
369 369
 
@@ -449,7 +449,7 @@ __rvm_detect_system()
449 449
         [[ -f /etc/debian_version ]]
450 450
       then
451 451
         _system_name="debian"
452  
-        _system_version="$(cat /etc/debian_version)"
  452
+        _system_version="$(\cat /etc/debian_version)"
453 453
       elif
454 454
         [[ -f /etc/fedora-release ]]
455 455
       then
@@ -478,7 +478,7 @@ __rvm_detect_system()
478 478
         [[ -f /etc/gentoo-release ]]
479 479
       then
480 480
         _system_name="gentoo"
481  
-        _system_version="base-$(cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
  481
+        _system_version="base-$(\cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
482 482
       elif
483 483
         [[ -f /etc/arch-release ]]
484 484
       then
2  scripts/get
@@ -4,7 +4,7 @@ source "$rvm_scripts_path/base"
4 4
 
5 5
 get_usage()
6 6
 {
7  
-  cat -v "$rvm_help_path/get"
  7
+  \cat -v "$rvm_help_path/get"
8 8
 }
9 9
 
10 10
 get_via_installer()
2  scripts/help
@@ -46,7 +46,7 @@ __rvm_help()
46 46
   else
47 47
     [[ -z "$1" ]] || rvm_error "Documentation for 'rvm $*' not found"
48 48
 
49  
-    cat "${rvm_path:-$HOME/.rvm}/README" | sed '1,2d' | __rvm_pager_or_cat_v -
  49
+    \cat "${rvm_path:-$HOME/.rvm}/README" | sed '1,2d' | __rvm_pager_or_cat_v -
50 50
 
51 51
     rvm_log "
52 52
   Commands available with 'rvm help':
2  scripts/info
@@ -51,7 +51,7 @@ info_rvm()
51 51
     version:      \"$(__rvm_version | \tr "\n" ' ' | __rvm_strip)\"
52 52
 "
53 53
   rvm_info="${rvm_info}    updated:      \""
54  
-  installed_at="$(cat ${rvm_path}/installed.at)"
  54
+  installed_at="$(\cat ${rvm_path}/installed.at)"
55 55
   if
56 56
     [[ -n "${installed_at:-}" ]] && (( installed_at ))
57 57
   then
2  scripts/list
@@ -262,7 +262,7 @@ list_known()
262 262
   then
263 263
     __rvm_pager_or_cat_v "$rvm_path/config/known"
264 264
   else
265  
-    cat "$rvm_path/config/known"
  265
+    \cat "$rvm_path/config/known"
266 266
   fi
267 267
 
268 268
   return $?
12  scripts/maglev
@@ -86,9 +86,9 @@ case "$system" in
86 86
     totalMemKB=$(awk '/MemTotal:/{print($2);}' /proc/meminfo)
87 87
     totalMem=$(($totalMemKB * 1024))
88 88
     # Figure out the max shared memory segment size currently allowed
89  
-    shmmax=$(cat /proc/sys/kernel/shmmax)
  89
+    shmmax=$(\cat /proc/sys/kernel/shmmax)
90 90
     # Figure out the max shared memory currently allowed
91  
-    shmall=$(cat /proc/sys/kernel/shmall)
  91
+    shmall=$(\cat /proc/sys/kernel/shmall)
92 92
     ;;
93 93
 
94 94
   Darwin)
@@ -188,8 +188,8 @@ then
188 188
   case "$system" in
189 189
     Linux)
190 190
       echo "# kernel.shm* settings added by MagLev installation" > /tmp/sysctl.conf.$$
191  
-      echo "kernel.shmmax=$(cat /proc/sys/kernel/shmmax)" >> /tmp/sysctl.conf.$$
192  
-      echo "kernel.shmall=$(cat /proc/sys/kernel/shmall)" >> /tmp/sysctl.conf.$$
  191
+      echo "kernel.shmmax=$(\cat /proc/sys/kernel/shmmax)" >> /tmp/sysctl.conf.$$
  192
+      echo "kernel.shmall=$(\cat /proc/sys/kernel/shmall)" >> /tmp/sysctl.conf.$$
193 193
       ;;
194 194
     Darwin)
195 195
       # On Mac OS X Leopard, you must have all five settings in sysctl.conf
@@ -212,8 +212,8 @@ then
212 212
   if [[ "$system" != "SunOS" ]]
213 213
   then
214 214
     rvm_log "Adding the following section to /etc/sysctl.conf"
215  
-    cat /tmp/sysctl.conf.$$
216  
-    sudo bash -c "cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
  215
+    \cat /tmp/sysctl.conf.$$
  216
+    sudo bash -c "\cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
217 217
     /bin/\rm -f /tmp/sysctl.conf.$$
218 218
   fi
219 219
 else
10  scripts/notes
@@ -7,7 +7,7 @@ fi
7 7
 if [[ "$1" == "initial" ]]
8 8
 then
9 9
   notes_type=Upgrade
10  
-  PAGER=cat
  10
+  PAGER=\cat
11 11
   new_notes()
12 12
   {
13 13
     typeset file
@@ -22,7 +22,7 @@ then
22 22
 elif [[ "$1" == "upgrade" ]]
23 23
 then
24 24
   notes_type=Upgrade
25  
-  PAGER=cat
  25
+  PAGER=\cat
26 26
   new_notes()
27 27
   {
28 28
     typeset file
@@ -43,7 +43,7 @@ else
43 43
   notes_type=Installation
44 44
   new_notes()
45 45
   {
46  
-    cat
  46
+    \cat
47 47
   }
48 48
   important_message()
49 49
   {
@@ -85,7 +85,7 @@ $notes_type Notes:
85 85
   : \
86 86
     rvm_scripts_path:${rvm_scripts_path:-$rvm_path/scripts}:
87 87
 
88  
-  cat "$rvm_path/help/upgrade-notes.txt" | sed \
  88
+  \cat "$rvm_path/help/upgrade-notes.txt" | sed \
89 89
    -e "s/\${SHELL}/${SHELL//\//\/}/g" \
90 90
    -e "s/\${rvm_scripts_path}/${rvm_scripts_path//\//\/}/g"
91 91
 
@@ -240,7 +240,7 @@ $notes_type Notes:
240 240
     rm /usr/local/bin/rvm
241 241
 "
242 242
   fi
243  
-} | new_notes | eval "${PAGER:-cat}"
  243
+} | new_notes | eval "${PAGER:-\cat}"
244 244
 
245 245
 rvm_warn "
246 246
 # RVM:  Shell scripts enabling management of multiple ruby environments.
2  scripts/patchsets
@@ -21,7 +21,7 @@ lookup_patchset()
21 21
   do
22 22
     if [[ -s "$lookup_path/$1" ]]
23 23
     then
24  
-      cat "$lookup_path/$1"
  24
+      \cat "$lookup_path/$1"
25 25
       return 0
26 26
     fi
27 27
   done
2  scripts/rvm
@@ -131,7 +131,7 @@ then
131 131
     __rvm_setup
132 132
 
133 133
     export rvm_version
134  
-    rvm_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
  134
+    rvm_version="$(\cat "$rvm_path/VERSION") ($(\cat "$rvm_path/RELEASE" 2>/dev/null))"
135 135
 
136 136
     alias rvm-restart="rvm_reload_flag=1 source '${rvm_scripts_path:-${rvm_path}/scripts}/rvm'"
137 137
 
2  scripts/snapshot
@@ -177,7 +177,7 @@ snapshot_load()
177 177
   \cp -f "$snapshot_temp_path/db" "$rvm_user_path/db"
178 178
 
179 179
   rvm_log "Installing rvm-managed packages"
180  
-  for snapshot_package in $(cat "$snapshot_temp_path/pkg")
  180
+  for snapshot_package in $(\cat "$snapshot_temp_path/pkg")
181 181
   do
182 182
     "$rvm_scripts_path/package" install "$snapshot_package"
183 183
     result="$?"
2  vboxtest/test_helper.sh
@@ -20,7 +20,7 @@ assert_status_equal () {
20 20
 }
21 21
 
22 22
 assert_output_equal () {
23  
-  expected=$(cat); actual=$1; lineno=$2
  23
+  expected=$(\cat); actual=$1; lineno=$2
24 24
 
25 25
   if [ "$actual" != "$expected" ]
26 26
   then
2  vboxtest/test_suite.sh
@@ -65,7 +65,7 @@ then
65 65
   }
66 66
 
67 67
   echo
68  
-  cat "$messages_file"
  68
+  \cat "$messages_file"
69 69
   echo "$(count_char "\." "$results_file") pass, $(count_char "F" "$results_file") fail"
70 70
   rm "$messages_file" "$results_file"
71 71
 fi

0 notes on commit 5226423

Please sign in to comment.
Something went wrong with that request. Please try again.