A simple script for turning up the eth interface and get ip address via dhcp. #!/bin/bash #Author: Cyrus #Purpose: A simple bash script that turns on eth interface and acquire IP address from dhcp server. n=$1 if [ $n -ge 0 ] then ifconfig eth$n up; dhclient eth$n #ifconfig eth$1 up; dhclient eth$1 else echo … Continue reading Bash script: Turn up eth
Bash: Watching selected log file.
Reference: http://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script There is an answer inside which actually works for my situation. Previous bash script which was not working #!/bin/bash LIST="syslog dmesg kern boot dpkg mintsystem Exit" PS3='Choose a log file to follow: ' select var in $LIST do if [ "$LIST" = "syslog" ] then watch tail /var/log/syslog elif [ "$LIST" = "dmesg" ] … Continue reading Bash: Watching selected log file.
Simple bash script
Install makepasswd apt-get install makepasswd makepasswd usage makepasswd --chars=N, where N is the length you want the password to be generated. The default --minchars is 8 and --maxchars is 10. Objective make a short script to generate password using makepasswd program. #!/bin/bash #randomly generate 8 character password with makepasswd. n=$1 if [ "$n" != "0" … Continue reading Simple bash script