Hello;
I've developed a passion for wrapping mkdir up in a utility function.
Is there a reason for not using either of the following two methods to
do it? Is there a better method I've not thought of?
1. Completely in .bashrc or some scripted sourced from .bashrc:
alias mkdir=cfs_mkdir
cfs_mkdir () {
local MKDIR=/usr/bin/mkdir
$MKDIR “$1”
cd “$1”
}
2. In a script in ~/bin that requires the following alias in .bashrc
`alias mkdir=cfs_mkdir.sh'
#!/bin/bash
# Name: cfs_mkdir.sh
script_function () {
local MKDIR=/usr/bin/mkdir
$MKDIR "$1"
cd "$1"
}
script_function "$@"
Pleae note that cd and cp perfect candidates for the same treatment!
Thanks in advance!
Joe