Skip to content

Category Archives: Bash

Bash Programming Cheat Sheet

30-Dec-08

A quick overview of Bash shell syntax: JustLinux’s Bash Programming Cheat Sheet.

Loop Over Each Line in a File using Bash

28-Dec-08

Use exec as below, for example:
exec < $PASSWORD_FILE
while read LINE; do
user=`echo $LINE | cut -d: -f1`
uid=`echo $LINE | cut -d: -f3`
pgroup=`echo $LINE | cut -d: -f4`
homedir=`echo $LINE | cut -d: -f6`
shell=`echo $LINE | cut -d: -f7`
gecos=`echo $LINE | cut -d: -f5`
cmd=”/usr/sbin/useradd [...]