Reorganization to hopefully prevent git conflicts.
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
dependencies=("fortune")
|
||||
|
||||
target="${3#fortune}"
|
||||
# Trim leading/trailing whitespace
|
||||
target="${target#"${target%%[![:space:]]*}"}"
|
||||
target="${target%"${target##*[![:space:]]}"}"
|
||||
|
||||
# Check dependencies before running
|
||||
if ! check_dependencies "${dependencies[@]}"; then
|
||||
@@ -12,6 +15,7 @@ if ! check_dependencies "${dependencies[@]}"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fortuneText="$(fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
|
||||
# Quote target to prevent command injection
|
||||
fortuneText="$(fortune -a -e -s -n 512 "$target" || echo "No fortunes found.")"
|
||||
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
|
||||
msg "$2" "$fortuneText"
|
||||
|
||||
Reference in New Issue
Block a user