Skip to content

Commit

Permalink
No output when input is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Reale committed Nov 16, 2016
1 parent 1d4405c commit de585d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/datatype/string
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ function bashlets_datatype_string_to_piglatin()
#
########################################################################

[[ -n $1 ]] || return

local prefix=${1%%[aeiouy]*}
local suffix=$(sed 's/^[bcdfghjklmnpqrstvxwz]*//' <<< $1)

Expand All @@ -181,6 +183,8 @@ function bashlets_datatype_string_to_piglatin()
[0-9] ) printf "$1 " ;;
* ) printf "${suffix}${prefix}ay " ;;
esac

printf "\n"
}


Expand Down

0 comments on commit de585d8

Please sign in to comment.