X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcore%2Ffunctions.sh;h=6d2bbe29aba4f4f15193e4e53505db6a2a4d26f0;hb=71303a6ccf382269d70249e7ab5a6bdc080bdca1;hp=6f447a74b79e4d07bfbba3cf677a2f182bf4d9de;hpb=8f9e4d54ecd9cca39c975b3107fb69a7b58e0057;p=feisty_meow.git diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 6f447a74..6d2bbe29 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -33,6 +33,20 @@ if [ -z "$skip_all" ]; then cd "$1" } + function success_sound() + { + if [ ! -z "$CLAM_FINISH_SOUND" ]; then + bash $FEISTY_MEOW_SCRIPTS/multimedia/sound_play.sh "$CLAM_FINISH_SOUND" + fi + } + + function error_sound() + { + if [ ! -z "$CLAM_ERROR_SOUND" ]; then + bash $FEISTY_MEOW_SCRIPTS/multimedia/sound_play.sh "$CLAM_ERROR_SOUND" + fi + } + # checks the result of the last command that was run, and if it failed, # then this complains and exits from bash. the function parameters are # used as the message to print as a complaint. @@ -40,6 +54,7 @@ if [ -z "$skip_all" ]; then { if [ $? -ne 0 ]; then echo -e "failed on: $*" + error_sound exit 1 fi } @@ -230,7 +245,7 @@ if [ -z "$skip_all" ]; then # label if they're doing an su with the sudo. function sudo() { local first_command="$1" - /usr/bin/sudo $* + /usr/bin/sudo "$@" if [ "$first_command" == "su" ]; then # yep, they were doing an su, but they're back now. bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh @@ -339,9 +354,11 @@ if [ -z "$skip_all" ]; then echo "text to replace that pattern with." return 1 fi - sed -i -e "s/$pattern/$replacement/" "$file" + sed -i -e "s%$pattern%$replacement%g" "$file" } + ############## + function function_sentinel() { return 0; } if [ ! -z "$SHELL_DEBUG" ]; then echo function definitions end....; fi