Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created August 12, 2010 10:52
Show Gist options
  • Save oelmekki/520732 to your computer and use it in GitHub Desktop.
Save oelmekki/520732 to your computer and use it in GitHub Desktop.
function cdm(){
target="$1"
if [[ ! -d $target ]]; then
mkdir -p $target;
fi
cd $target
unset target
}
function mvm(){
src="$1"
dest="$2"
if [[ $dest =~ /$ ]]; then
target=$dest
else
target="$(dirname $2)"
fi
if [[ ! -d $target ]]; then
mkdir -p $target
fi
mv $src $dest
unset src dest target
}
function cpm(){
src="$1"
dest="$2"
if [[ $dest =~ /$ ]]; then
target=$dest
else
target="$(dirname $2)"
fi
if [[ ! -d $target ]]; then
mkdir -p $target
fi
cp $src $dest
unset src dest target
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment