7 if [ ! -f "$arg" -a ! -d "$arg" ]; then
8 echo "=> did not find a file or directory named '$arg'."
12 # we capture the output of the character replacement operation for reporting.
13 # this is done first since some filenames cannot be properly renamed in perl (e.g. if they
14 # have pipe characters apparently).
15 intermediate_name="$(bash "$FEISTY_MEOW_SCRIPTS/files/replace_spaces_with_underscores.sh" "$arg")"
16 local saw_intermediate_result=0
17 if [ -z "$intermediate_name" ]; then
18 # make sure we report something, if there are no further name changes.
19 intermediate_name="'$arg'"
21 # now zap the first part of the name off (since original name is not needed).
22 intermediate_name="$(echo $intermediate_name | sed -e 's/.*=> //')"
23 saw_intermediate_result=1
26 # here we rename the file to be lower case.
27 actual_file="$(echo $intermediate_name | sed -e "s/'\([^']*\)'/\1/")"
28 final_name="$(perl "$FEISTY_MEOW_SCRIPTS/files/renlower.pl" "$actual_file")"
29 local saw_final_result=0
30 if [ -z "$final_name" ]; then
31 final_name="$intermediate_name"
33 final_name="$(echo $final_name | sed -e 's/.*=> //' )"
37 if [[ $saw_intermediate_result != 0 || $saw_final_result != 0 ]]; then
38 # printout the combined operation results.
39 echo "'$arg' => $final_name"
44 # this block should execute when the script is actually run, rather
45 # than when it is just being sourced.
46 if [[ $0 =~ .*spacem\.sh.* ]]; then
47 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
48 exit_on_error "sourcing the feisty meow environment"
50 exit_on_error "running spacem_out on a list: ${@}"