Thursday, 26 January 2012

Download files using shell

This is just a basic for the beginners

#!/bin/bash
echo -en "\e[31mEnter link To Download:\e[0m "  

# echo -en "\e[31;1mEnter link:\e[0m "  
# -n so that the value can be entered in the same line itself.

read lnk

#echo -e "\e[0m"
# read command reads the value from standard input.

cd /root/downloads && wget $lnk

# 31 - Red
# 32 - Green
# 34 - Blue

# 31;1m - Bold Red
# 31;7m - Invert Red to background.

Make shell script interactive using ' read '

We can make the shell script interactive. read will let the user to enter values while the script is being executed. Input entered through the keyboard read into the variables followedby read, and the program execution continues.


No comments:

Post a Comment