Skip to content

Commit

Permalink
Merge pull request #1758 from robotarmy/master
Browse files Browse the repository at this point in the history
Escaped Cat Avoids Alias
  • Loading branch information
envygeeks committed Apr 2, 2013
2 parents c503718 + 5226423 commit 23d5018
Show file tree
Hide file tree
Showing 30 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion binscripts/rvm-installer
Expand Up @@ -525,7 +525,7 @@ case "${version}" in

(latest-minor)
echo "${version}" > "$rvm_path/RELEASE"
version="$(cat "$rvm_path/VERSION")"
version="$(\cat "$rvm_path/VERSION")"
install_release $(fetch_version "${version%.*}") || exit $?
;;

Expand Down
2 changes: 1 addition & 1 deletion scripts/alias
Expand Up @@ -171,7 +171,7 @@ alias_list() {
typeset item
case "${alias_name}" in
(names)
cat - # just show it
\cat - # just show it
;;
(*)
while
Expand Down
2 changes: 1 addition & 1 deletion scripts/cli
Expand Up @@ -870,7 +870,7 @@ Error:
unset rvm_rvmrc_files
fi

disk_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
disk_version="$(\cat "$rvm_path/VERSION") ($(\cat "$rvm_path/RELEASE" 2>/dev/null))"
if
[[ -s "$rvm_path/VERSION" &&
"${rvm_version:-}" != "${disk_version:-}" &&
Expand Down
2 changes: 1 addition & 1 deletion scripts/cron
Expand Up @@ -43,7 +43,7 @@ __rvm_cron_command()

__sm.cron.show()
{
EDITOR=cat crontab -e 2>/dev/null
EDITOR=\cat crontab -e 2>/dev/null
}

__sm.filter.remove.group()
Expand Down
4 changes: 2 additions & 2 deletions scripts/env
Expand Up @@ -11,9 +11,9 @@ then
elif
[[ "$rvm_cron_flag" == "1" || "$*" =~ "--cron" ]]
then
cat "$environment_file_path" |
\cat "$environment_file_path" |
GREP_OPTIONS="" \grep -Eo "[^ ]+=[^;]+" |
sed -e 's/\$PATH/'"${PATH//\//\/}"'/' -e 's/\${PATH}/'"${PATH//\//\/}"'/'
else
cat "$environment_file_path"
\cat "$environment_file_path"
fi
2 changes: 1 addition & 1 deletion scripts/external
Expand Up @@ -31,7 +31,7 @@ external_grep_existing()
then
GREP_OPTIONS="" \grep -vE "${existing[*]}" -
else
cat -
\cat -
fi
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/extras/rails
Expand Up @@ -121,14 +121,14 @@ rails_routes()
md5_current=${md5%% *}

if [[ -s "$cache_file" && -s "$cache_file.md5" ]]; then
md5_cached=$(cat -v "${cache_file}.md5")
md5_cached=$(\cat -v "${cache_file}.md5")
md5_cached=${md5%% *}
else
md5_cached=""
fi

if [[ -s "$cache_file" && $md5_current == $md5_cached ]]; then
routes=$(cat -v "$cache_file")
routes=$(\cat -v "$cache_file")
else
routes=$(rake routes 2>/dev/null)
if [[ $? -gt 0 ]]; then
Expand Down
4 changes: 2 additions & 2 deletions scripts/functions/benchmark
Expand Up @@ -14,7 +14,7 @@ __rvm_benchmark()

unset code

cat $rvm_ruby_file >> "${rvm_tmp_path}/$$.rb"
\cat $rvm_ruby_file >> "${rvm_tmp_path}/$$.rb"

printf "%b" "\n end \nend\n" >> "${rvm_tmp_path}/$$.rb"

Expand All @@ -27,7 +27,7 @@ __rvm_benchmark()
if [[ ${rvm_debug_flag:0} -gt 0 ]] ; then

printf "%b" "\n${rvm_tmp_path}/$$.rb:\n\
$(cat ${rvm_tmp_path}/$$.rb)"
$(\cat ${rvm_tmp_path}/$$.rb)"

fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/build
Expand Up @@ -167,7 +167,7 @@ __rvm_update_configure_opt_dir_flags()
{
typeset __enable_rpath __lib_path
if
which bash | xargs head -n 1 | cat -e | \grep -b '^^?ELF' >/dev/null
which bash | xargs head -n 1 | \cat -e | \grep -b '^^?ELF' >/dev/null
then
__enable_rpath="true"
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/build_config
Expand Up @@ -387,7 +387,7 @@ __rvm_detect_max_threads()
fi
;;
(*)
cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l
\cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l
;;
esac
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/env
Expand Up @@ -194,7 +194,7 @@ __rvm_unload_action()
typeset -a _list

IFS=$'\n'
_list=( $( cat ${2:--} | sort -u ) )
_list=( $( \cat ${2:--} | sort -u ) )
for _element in "${_list[@]}"
do $1 "${_element}"
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/group
Expand Up @@ -43,7 +43,7 @@ __rvm_list_all_users()
dscl . -search /Users PrimaryGroupID 20 | GREP_OPTIONS="" \grep PrimaryGroupID | cut -f 1
;;
*)
GREP_OPTIONS="" \grep -xF -f <(cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)
GREP_OPTIONS="" \grep -xF -f <(\cat /etc/passwd | cut -d: -f1) <(find /home -mindepth 1 -maxdepth 1 -type d | cut -d '/' -f 3)
;;
esac
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/installer
Expand Up @@ -1006,7 +1006,7 @@ setup_etc_bashrc()
[[ -f "${new_content_path}" ]] || \rm -f "${new_content_path}"
{
print_etc_bashrc_change # prepend
cat "${system_bashrc_file}"
\cat "${system_bashrc_file}"
} > "${new_content_path}" &&
\mv "${new_content_path}" "${system_bashrc_file}"
fi
Expand Down
6 changes: 3 additions & 3 deletions scripts/functions/logging
Expand Up @@ -100,8 +100,8 @@ rvm_debug_stream()
{
(( ${rvm_debug_flag:-0} || ${rvm_trace_flag:-0} )) || return 0
if rvm_pretty_print stdout
then cat - | awk '{print "'"${rvm_debug_clr:-}"'"$0"'"${rvm_reset_clr:-}"'"}'
else cat -
then \cat - | awk '{print "'"${rvm_debug_clr:-}"'"$0"'"${rvm_reset_clr:-}"'"}'
else \cat -
fi >&2
}
rvm_log()
Expand Down Expand Up @@ -211,6 +211,6 @@ __rvm_table()
echo "$1" | __rvm_table_wrap_text
fi
__rvm_table_br
cat "${2:--}" | __rvm_table_wrap_text
\cat "${2:--}" | __rvm_table_wrap_text
__rvm_table_br
}
2 changes: 1 addition & 1 deletion scripts/functions/manage/macruby
Expand Up @@ -97,7 +97,7 @@ macruby_install()
binaries=(erb gem irb rake rdoc ri ruby testrb)
for binary_name in ${binaries[@]}; do
# TODO: This should be generated via an external script.
ruby_wrapper=$(cat <<RubyWrapper
ruby_wrapper=$(\cat <<RubyWrapper
#!/usr/bin/env bash
export GEM_HOME="\${GEM_HOME:-$rvm_ruby_gem_home}"
Expand Down
4 changes: 2 additions & 2 deletions scripts/functions/rvmrc_project
Expand Up @@ -153,11 +153,11 @@ __rvm_load_project_config()
rvm_previous_environment="$(__rvm_env_string)"
rvm_current_rvmrc="$1"

rvm_ruby_string="$(cat "$1")"
rvm_ruby_string="$(\cat "$1")"
[[ -n "${rvm_ruby_string}" ]] || return 2
if [[ -f "$(dirname $1)/.ruby-gemset" ]]
then
rvm_gemset_name="$(cat "$(dirname $1)/.ruby-gemset")"
rvm_gemset_name="$(\cat "$(dirname $1)/.ruby-gemset")"
fi
rvm_create_flag=1 __rvm_use || return 3
# "$(dirname $1)/.rbenv-vars" ... can we support those without licensing ?
Expand Down
4 changes: 2 additions & 2 deletions scripts/functions/rvmrc_trust
Expand Up @@ -31,12 +31,12 @@ __rvm_sha256_for_contents()
__rvm_checksum_for_contents()
{
typeset __sum
__sum=$( echo "$1" | cat - "$1" | __rvm_md5_for_contents ) ||
__sum=$( echo "$1" | \cat - "$1" | __rvm_md5_for_contents ) ||
{
rvm_error "Neither md5 nor md5sum were found in the PATH"
return 1
}
__sum+=$( echo "$1" | cat - "$1" | __rvm_sha256_for_contents ) ||
__sum+=$( echo "$1" | \cat - "$1" | __rvm_sha256_for_contents ) ||
{
rvm_error "Neither sha256sum nor shasum found in the PATH"
return 1
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/rvmrc_warning
Expand Up @@ -68,7 +68,7 @@ __rvmrc_warning_list()
{
rvm_log "# List of project files that ignore warnings:"
if [[ -s "$__rvmrc_warning_path" ]]
then cat "$__rvmrc_warning_path"
then \cat "$__rvmrc_warning_path"
fi
}

Expand Down
10 changes: 5 additions & 5 deletions scripts/functions/utility
Expand Up @@ -342,7 +342,7 @@ __rvm_version_compare()

__rvm_pager_or_cat_v()
{
eval "${PAGER:-cat -v} '$1'"
eval "${PAGER:-\cat -v} '$1'"
}

__rvm_ask_for()
Expand All @@ -362,8 +362,8 @@ __rvm_read_lines()
IFS="
"
if [[ "${2:--}" == "-" ]]
then eval "$1=( \$( cat - ) )"
else eval "$1=( \$( cat \"\${2:--}\" ) )"
then eval "$1=( \$( \cat - ) )"
else eval "$1=( \$( \cat \"\${2:--}\" ) )"
fi
}

Expand Down Expand Up @@ -449,7 +449,7 @@ __rvm_detect_system()
[[ -f /etc/debian_version ]]
then
_system_name="debian"
_system_version="$(cat /etc/debian_version)"
_system_version="$(\cat /etc/debian_version)"
elif
[[ -f /etc/fedora-release ]]
then
Expand Down Expand Up @@ -478,7 +478,7 @@ __rvm_detect_system()
[[ -f /etc/gentoo-release ]]
then
_system_name="gentoo"
_system_version="base-$(cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
_system_version="base-$(\cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
elif
[[ -f /etc/arch-release ]]
then
Expand Down
2 changes: 1 addition & 1 deletion scripts/get
Expand Up @@ -4,7 +4,7 @@ source "$rvm_scripts_path/base"

get_usage()
{
cat -v "$rvm_help_path/get"
\cat -v "$rvm_help_path/get"
}

get_via_installer()
Expand Down
2 changes: 1 addition & 1 deletion scripts/help
Expand Up @@ -46,7 +46,7 @@ __rvm_help()
else
[[ -z "$1" ]] || rvm_error "Documentation for 'rvm $*' not found"

cat "${rvm_path:-$HOME/.rvm}/README" | sed '1,2d' | __rvm_pager_or_cat_v -
\cat "${rvm_path:-$HOME/.rvm}/README" | sed '1,2d' | __rvm_pager_or_cat_v -

rvm_log "
Commands available with 'rvm help':
Expand Down
2 changes: 1 addition & 1 deletion scripts/info
Expand Up @@ -51,7 +51,7 @@ info_rvm()
version: \"$(__rvm_version | \tr "\n" ' ' | __rvm_strip)\"
"
rvm_info="${rvm_info} updated: \""
installed_at="$(cat ${rvm_path}/installed.at)"
installed_at="$(\cat ${rvm_path}/installed.at)"
if
[[ -n "${installed_at:-}" ]] && (( installed_at ))
then
Expand Down
2 changes: 1 addition & 1 deletion scripts/list
Expand Up @@ -262,7 +262,7 @@ list_known()
then
__rvm_pager_or_cat_v "$rvm_path/config/known"
else
cat "$rvm_path/config/known"
\cat "$rvm_path/config/known"
fi

return $?
Expand Down
12 changes: 6 additions & 6 deletions scripts/maglev
Expand Up @@ -86,9 +86,9 @@ case "$system" in
totalMemKB=$(awk '/MemTotal:/{print($2);}' /proc/meminfo)
totalMem=$(($totalMemKB * 1024))
# Figure out the max shared memory segment size currently allowed
shmmax=$(cat /proc/sys/kernel/shmmax)
shmmax=$(\cat /proc/sys/kernel/shmmax)
# Figure out the max shared memory currently allowed
shmall=$(cat /proc/sys/kernel/shmall)
shmall=$(\cat /proc/sys/kernel/shmall)
;;

Darwin)
Expand Down Expand Up @@ -188,8 +188,8 @@ then
case "$system" in
Linux)
echo "# kernel.shm* settings added by MagLev installation" > /tmp/sysctl.conf.$$
echo "kernel.shmmax=$(cat /proc/sys/kernel/shmmax)" >> /tmp/sysctl.conf.$$
echo "kernel.shmall=$(cat /proc/sys/kernel/shmall)" >> /tmp/sysctl.conf.$$
echo "kernel.shmmax=$(\cat /proc/sys/kernel/shmmax)" >> /tmp/sysctl.conf.$$
echo "kernel.shmall=$(\cat /proc/sys/kernel/shmall)" >> /tmp/sysctl.conf.$$
;;
Darwin)
# On Mac OS X Leopard, you must have all five settings in sysctl.conf
Expand All @@ -212,8 +212,8 @@ then
if [[ "$system" != "SunOS" ]]
then
rvm_log "Adding the following section to /etc/sysctl.conf"
cat /tmp/sysctl.conf.$$
sudo bash -c "cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
\cat /tmp/sysctl.conf.$$
sudo bash -c "\cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
/bin/\rm -f /tmp/sysctl.conf.$$
fi
else
Expand Down
10 changes: 5 additions & 5 deletions scripts/notes
Expand Up @@ -7,7 +7,7 @@ fi
if [[ "$1" == "initial" ]]
then
notes_type=Upgrade
PAGER=cat
PAGER=\cat
new_notes()
{
typeset file
Expand All @@ -22,7 +22,7 @@ then
elif [[ "$1" == "upgrade" ]]
then
notes_type=Upgrade
PAGER=cat
PAGER=\cat
new_notes()
{
typeset file
Expand All @@ -43,7 +43,7 @@ else
notes_type=Installation
new_notes()
{
cat
\cat
}
important_message()
{
Expand Down Expand Up @@ -85,7 +85,7 @@ $notes_type Notes:
: \
rvm_scripts_path:${rvm_scripts_path:-$rvm_path/scripts}:

cat "$rvm_path/help/upgrade-notes.txt" | sed \
\cat "$rvm_path/help/upgrade-notes.txt" | sed \
-e "s/\${SHELL}/${SHELL//\//\/}/g" \
-e "s/\${rvm_scripts_path}/${rvm_scripts_path//\//\/}/g"

Expand Down Expand Up @@ -240,7 +240,7 @@ $notes_type Notes:
rm /usr/local/bin/rvm
"
fi
} | new_notes | eval "${PAGER:-cat}"
} | new_notes | eval "${PAGER:-\cat}"

rvm_warn "
# RVM: Shell scripts enabling management of multiple ruby environments.
Expand Down
2 changes: 1 addition & 1 deletion scripts/patchsets
Expand Up @@ -21,7 +21,7 @@ lookup_patchset()
do
if [[ -s "$lookup_path/$1" ]]
then
cat "$lookup_path/$1"
\cat "$lookup_path/$1"
return 0
fi
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/rvm
Expand Up @@ -131,7 +131,7 @@ then
__rvm_setup

export rvm_version
rvm_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
rvm_version="$(\cat "$rvm_path/VERSION") ($(\cat "$rvm_path/RELEASE" 2>/dev/null))"

alias rvm-restart="rvm_reload_flag=1 source '${rvm_scripts_path:-${rvm_path}/scripts}/rvm'"

Expand Down
2 changes: 1 addition & 1 deletion scripts/snapshot
Expand Up @@ -177,7 +177,7 @@ snapshot_load()
\cp -f "$snapshot_temp_path/db" "$rvm_user_path/db"

rvm_log "Installing rvm-managed packages"
for snapshot_package in $(cat "$snapshot_temp_path/pkg")
for snapshot_package in $(\cat "$snapshot_temp_path/pkg")
do
"$rvm_scripts_path/package" install "$snapshot_package"
result="$?"
Expand Down
2 changes: 1 addition & 1 deletion vboxtest/test_helper.sh
Expand Up @@ -20,7 +20,7 @@ assert_status_equal () {
}

assert_output_equal () {
expected=$(cat); actual=$1; lineno=$2
expected=$(\cat); actual=$1; lineno=$2

if [ "$actual" != "$expected" ]
then
Expand Down

0 comments on commit 23d5018

Please sign in to comment.