You need to use command line argument i.e. called as $1 in bash script, shown in screenshot below
###############Script Starts Here#################
#!/bin/bash
#Developed By - Krunal Patel
echo "IP Address of interface $1 is : " $(ifconfig $1 | grep -i "inet addr" | cut -d":" -f2 | cut -d" " -f1)
###############Script Ends Here##################
No comments:
Post a Comment
Please give us suggestions.