Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Networking

FTP script with nested function

Submitted by on November 20, 2005 – 2:14 am One Comment

An example of an FTP script with Korn shell.

For “$CONFTMP” input file of format: hostname username password

cat "$CONFTMP" | fgrep -v "#" | while read LINE
		FTPHOST=$(echo "$LINE" | awk '{print $1}')
		FTPUSER=$(echo "$LINE" | awk '{print $2}')
		FTPPASS=$(echo "$LINE" | awk '{print $3}')

		FTPPUT() {
				echo "open $FTPHOST"
				echo "user $FTPUSER $FTPPASS"
				echo "lcd $LOCALDIR"
				echo "cd $REMOTEDIR"
				echo "put $FILENAME"
				echo "quit"
			} | ftp -nvi -T 3

		echo "Uploading to $FTPHOST"
		echo "--------------------------"
Print Friendly, PDF & Email

One Comment »

  • thexbox360player says:

    I have a long script and I need to upload it online to make it a website. I have NO money, therefore need a FREE web hosting provider??? Could someone give me step by step guide on how to do this???
    Thanks in Advance!!!!!!!

Leave a Reply

%d bloggers like this: