Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of Android Wireless Application Development
Image of Modern Operating Systems (3rd Edition)
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)

Sudo and Globbing

The question is how we can use the sudo utility to display a list of files in a directory to which we have absolutely no Unix filesystem privileges Consider the following directory and files contained therein: $ ls -l total 4 drwxrwx—. 2 root root 4096 May 22 21:14 demo $ su Password: XXXXXXXX # ls -l demo total 0 -rw-r–r–. 1 root root 0 May 22 21:14 file1 -rw-r–r–. 1 root root 0 May 22 21:14 file2 -rw-r–r–. 1 root root 0 May 22 21:14 file3 # exit exit Note the directory permissions are 770 and the user and

Korn Shell Multidimensional Arrays

The bash shell only supports single dimension arrays. Korn Shell 93 (ksh93), on the other hand, supports multidimensional arrays although this feature is poorly documented. Here is a simple example which demonstrates how to create and use a multidimensional array: #!/bin/ksh93 for i in 1 2 3 do for j in 4 5 6 do for k in 7 8 9 do array[$i][$j][$k]=$(( i + j + k )) # echo ${array[$i][$j][$k]} done done done for i in 1 2 3 do echo ${array[$i][4][7]} done It outputs: 12 13 14 Note – multidimensional associative arrays are not supported.