8 if [ ! -f "$arg" -a ! -d "$arg" ]; then
9 echo "=> did not find a file or directory named '$arg'."
13 # we 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 echo no new intermed name reported
20 # make sure we report something, if there are no further name changes.
21 intermediate_name="'$arg'"
23 # now zap the first part of the name off (since original name is not needed).
24 intermediate_name="$(echo $intermediate_name | sed -e 's/.*=> //')"
25 saw_intermediate_result=1
28 # here we rename the file to be lower case.
29 actual_file="$(echo $intermediate_name | sed -e "s/'\([^']*\)'/\1/")"
30 echo actual file computed: $actual_file
31 final_name="$(perl "$FEISTY_MEOW_SCRIPTS/files/renlower.pl" "$actual_file")"
32 local saw_final_result=0
33 echo temp final name is: $final_name
34 if [ -z "$final_name" ]; then
35 final_name="$intermediate_name"
37 final_name="$(echo $final_name | sed -e 's/.*=> //' )"
40 echo intermed result=$saw_intermediate_result
41 echo intermed name=$intermediate_name
42 echo final result=$saw_final_result
43 echo final name=$final_name
45 if [[ $saw_intermediate_result != 0 || $saw_final_result != 0 ]]; then
46 # printout the combined operation results.
47 echo "'$arg' => $final_name"
52 # this block should execute when the script is actually run, rather
53 # than when it is just being sourced.
54 if [[ $0 =~ .*spacem\.sh.* ]]; then
55 echo inside exec block for spacem
56 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
57 exit_on_error "sourcing the feisty meow environment"
59 exit_on_error "running spacem_out on a list: ${@}"