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

shell programming and C/C++ are not the same thing. maybe a moderator will move your post for you.

Anyway, in shell there is no way without writing code (the ncurses library provides calls to do this) without resorting to C/C++ code. Plus you have to be in graphics mode....

see for someone with the same probleem.:
http://www.unix.com/showthread.php?t=26162&highlight=cursor+position

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[@]}
commented: bad -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.