Improve how return value of certain commands are checked

This commit is contained in:
2012-04-26 02:41:13 +01:00
parent b0b8d29d27
commit d4dfe39037
3 changed files with 7 additions and 9 deletions

View File

@@ -24,10 +24,9 @@ case "$command" in
;; ;;
* ) * )
# Lookup command, attempt to resolve as alias if fails
! command_path="$(command -v "tmuxifier-$command")" ! command_path="$(command -v "tmuxifier-$command")"
if [ ! -n $? ]; then
# Attempt to resolve aliases
if [ -z "$command_path" ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
! command_path="$(command -v "tmuxifier-$resolved")" ! command_path="$(command -v "tmuxifier-$resolved")"

View File

@@ -18,10 +18,9 @@ if [ -z "$command" ]; then
exit 1 exit 1
fi fi
# Lookup command, attempt to resolve as alias if fails
! command_path="$(command -v "tmuxifier-$command")" ! command_path="$(command -v "tmuxifier-$command")"
if [ ! -n $? ]; then
# Attempt to resolve aliases
if [ -z "$command_path" ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
! command_path="$(command -v "tmuxifier-$resolved")" ! command_path="$(command -v "tmuxifier-$resolved")"

View File

@@ -9,10 +9,10 @@ if [ "$1" == "--complete" ]; then
fi fi
command="$1" command="$1"
! command_path="$(command -v "tmuxifier-$command")"
# Attempt to resolve aliases # Lookup command, attempt to resolve as alias if fails
if [ -z "$command_path" ]; then ! command_path="$(command -v "tmuxifier-$command")"
if [ ! -n $? ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
command="$resolved" command="$resolved"