Translate

Archives

Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Beginning Google Maps API 3
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Linux Kernel Development (3rd Edition)

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.