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")"
# Attempt to resolve aliases
if [ -z "$command_path" ]; then
if [ ! -n $? ]; then
resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then
! command_path="$(command -v "tmuxifier-$resolved")"

View File

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

View File

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