Start New Discussion within our Software Development Community

Dear All,

I have just started, playing with unix shell programming.
I am in need to know, that how to get the position of cursor at unix shell.

To set the cursor position i am using command
# tput cup x y

In case anybody is still looking for this .

function ReceiveCmd {
		local Reply=""
		while IFS= read -srN1 ; do 
			 [ "${REPLY}" != "${1}" ] || break
			 Reply+="${REPLY}" 
		done
		REPLY="${Reply}" 
	}
	function GetCurPos {
		echo -n $'\e[6n' ; ReceiveCmd R
		IFS=';' REPLY=( ${REPLY:2} )
	}
GetCurPos
echo ${REPLY[@]}
Comments
bad
This article has been dead for over six months. Start a new discussion instead.