dir=$(dirname /some/path/to/a/file) result="$dir/$(basename /some/path/to/a/file | tr -s '[:upper:]' '[:lower:]' )" echo "$result"