nav-left cat-right
cat-right

Bash puzzle: Unset last element of an array...

Here is a puzzle for bash lovers. This is taken from shell scripting community at Orkut. Question: How to reset last element of an array even if it’s a discontinuous array. Answer: $ array=([0]=a [9]=d [2]=i [6]=k); echo "${array[@]}" a i k d $ : ${!array[@]} $ unset array[_] $ echo "${array[@]}" a i k If you are not familiar with bash, you might...

apropos: search the whatis database for strings or...

Did you ever sweat as you couldn’t find which commands deal with particular keywords? All linux users know they can get complete details about a command/system call from man pages. But, what if you don’t know the command? Yes, you can use apropos in such a situation . apropos searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard...

ptmx and pts – pseudo-terminal master and sl...

NAME ptmx and pts – pseudo-terminal master and slave DESCRIPTION The file /dev/ptmx is a character file with major number 5 and minor number 2, usually of mode 0666 and owner.group of root.root. It is used to create a pseudo-terminal master and slave pair. When a process opens /dev/ptmx, it gets a file descriptor for a pseudo-terminal master (PTM), and a pseudo-terminal slave (PTS) device is created in the /dev/pts...