Alias cd and ls with support for spaces and arguments
So I started with this discussion, and it basically does exactly what I want.
However, the solution to preserve directory whitespace using quotes fails
when using arguments, e.g. "cd -P dir". Any ideas for preserving
whitespace and allowing for option flags?
This is the function I'm currently using.
function cd {
new_directory="$*";
if [ $# -eq 0 ]; then
new_directory=${HOME};
fi;
builtin cd "${new_directory}" && ls;
}
No comments:
Post a Comment