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