Home » Articles » Archives for Olivier Contant

Author: Olivier Contant

Grub manual booting Linux

grub> set pager=1 grub> ls (…will list (hd0) (hd0,msdos2) (hd0,msdos1) and similar…) grub> ls (hd0,1) or (hd0,msdos2,1) or whatever-partition (…until you find the partition which contains /bin, /boot, /dev, etc…) grub> set root=(hd0,1) grub> linux /boot/vmlinuz-3.13.0–29-generic root=/dev/sda1 (…substitute your own kernel versions + disk partition, of course…) grub> initrd /boot/initrd.img-3.13.0–29-generic grub> boot Once this routine …

Read more

Shell Script function to manage execution error

A simple shell script to manage execution error and display a meaningful message to the user This function was designed for Korn Shell *ksh93* and should be POSIX Compliant. Please message me if you have suggestion to make it better. ### Simple function to display separator character on the size of terminal width f_print_separator () …

Read more

Shell Script function get password

How to securely get a password from a user in a POSIX Compliant Shell Script.   There is 2 ways to create a function to securely get password in a shell script. 1. ksh93 and bash compliant: read -rsp "contextual message" variable 2. POSIX Compliant: printf %s "contextual message"; stty -echo; read passwd; stty echo; …

Read more

Korn Shell – Variables Quick Reference

Korn Shell – Variables Quick Reference Typeset type and attribute options -A Create an associative array. -En Represent the variable internally as a double-precision floating-point number; improves the efficiency of floating-point arithmetic. If n is given, it is the number of significant figures to use in output. Large numbers print in scientific notation: [-]d.ddde±dd. Smaller …

Read more

Why is printf better than echo in Shell Scripting?

Basically, it’s a portability (and reliability) issue. Initially, echo didn’t accept any option and didn’t expand anything. All it was doing was outputting its arguments separated by a space character and terminated by a newline character. Now, someone thought it would be nice if we could do things like echo "\n\t" to output newline or …

Read more