Re: default behavior of window-to-workspace



Better version:

> Variant #2 (not fully compatible, but more 1337):
> 
> mvcd () {
> 
> 	if [[ $1 == --help || $1 == -h ]]; then
> 		mv --help
> 		exit 0
> 	elif [[ ${#} -lt "2" ]]; then
> 		echo "not enough arguments"
> 		exit 1
> 	fi
> 
> 	destination="${!#}"
> 
> 	if [[ "${destination}" == */ && ! -e "${destination}" ]]; then
> 		 mkdir -p "${!destination}"
> 	elif [[ "${destination}" == */ && -f "${destination}" ]]; then
> 		echo "destination already exists, but is a file."
> 		exit 1
> 	fi
> 
> 	args=( "$@" )
> 	unset args[$#-1]
> 	set -- "${args[ ]}"
> 
> 	for path in "${args[ ]}"; do
> 	      test "${path:0:1}" == - && MV_OPTS+="$path " && continue
> 	      mv $MV_OPTS "${path}" "${destination}"
> 	done
> 
> 	if [[ -d "${destination}" ]]; then
> 		builtin cd "${destination}"
> 	fi
> 
> }




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]