My Little Shell Script

I have a script that I used for many years as a tools for migration, installation and configuration in Linux and FreeBSD. I love my little script. It will read my input file, count the number of lines, read the lines one by one, cut the line and put it into input that I want. Echo it back into template that I've define and loop and loop until end of the lines.

That's my little shell script.

Quote is my shell script is a migration script of vpopmail passwd file into Linux passwd/shadow format so I can run migration tools from padl nss_ldap to create LDIF format (PosixAccount) that suitable to be used with DBmail.

But, Bro root script much more simpler that this and one liner if it can be. Hehehe.



#!/bin/bash
NOUID=500
TOTALL=`wc -l $1 | awk '{print $1}'`
KIRA=1
while [ $KIRA -le $TOTALL ]
do
echo "$KIRA"
BARIS1=`head -$KIRA $1 | tail -1`
NAMAUSER=`echo $BARIS1 | cut -d: -f1`
KATALALUAN=`echo $BARIS1 | cut -d: -f2`
NAMAPENUH=`echo $BARIS1 | cut -d: -f5`
NOUID=`expr $NOUID + 1`
#
### rpm:x:37:37::/var/lib/rpm:/sbin/nologin
echo "$NAMAUSER:x:$NOUID:12:$NAMAPENUH:/home/$NAMAUSER:/sbin/nologin" >> password$$.txt
echo "$NAMAUSER:$KATALALUAN:13941:0:99999:7:::" >> shadow$$.txt
#dbmail-users -v -a $NAMAUSER -wlaluan123 -p md5-base64 -m 100M -s $BARIS1
#
KIRA=`expr $KIRA + 1`
done
exit


Popular Posts

Labels

64bit Activity Adempire advocate Akta Apache ASAS Azam backup backuppc Bash Beowulf Big Data Broadband Budget Centos Cinta Cluster CMS cmsfornerd Company Complain computer Computer Operation Conference Contest Data Centre Operation DBmail Digg Digital Certification Discussion Group Django DNS Docker Domain Duit Online Economy Elastic Stack Elasticsearch ELK email email server English Evangelist Events Family Tree Fedora File System Firefox Foss FOSS.my FreeBSD FTX Gesaan Gluster Gmail Godaddy.com Google Google App GTUG Hacking Hadoop hafnie Harisfazillah Jamel horde HP-UX hwclock IBM ICT Service Delivery and Operation Indonesia Internet Internet Tools Itanium Jabatan IT Negara Jaring Java Javascript Jepun Jiwang Joke Joomla K3S K3Sup Kernel Kesihatan Kibana KOSTEM Kubernetes ldap Linux Linux Counter linuxmalaysia Logstash Love Mailman MailScanner Mailwatch Malay Malaysia MAMPU MDeC meetup Melaka Melayu Merdeka Microsoft Migration mirror sites Money Online Monitor MOSC 2010 MOSC2010 mosc2011 MOSC2013 MOSCMY MOSCMY2014 MOSCMY2015 Mozilla MPI MSC Malaysia MSC Malaysia OSCONF MSCOSCONF My Love MyGOSSCON MyMeeting Mypenguin99 mysql Nagios NagiosQL Negaraku nss_ldap ntp OBW2014 Open Office Open Source openldap Openoffice.org OpenStack Opera OS2 OS400 OSCC OSCC MAMPU osdc.my OSS OSS Policy OWASP Parallel Computing People Power Personal Petition PGP PHP Pligg Podman Politik Postfix Postgresql Programming Proxmox Python q1moscmy2015 Questionnaires Research Research tools RPM SASSIAN Sassian 85-89 Sassians 85-89 SCO Security Sekolah Sekolah Alam Shah Shell script Software License Solaris SongketMail SongketMailFilter sourceforge spam spamassassin Spoof Survey SVR4 System Tools Technorati Terjemahan Terminal TMnet Tor Training translation Treasury Malaysia Trend Micro Twitter Ubuntu Unix Virtualization VMS VOIP Wang Web Server Windows Zimbra
 

LinuxMalaysia Mastodon