Content deleted Content added
imported>mutante mNo edit summary |
No edit summary |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 6: | Line 6: | ||
<pre> |
<pre> |
||
geist:/home/mutante# dpkg --get-selections | grep apache2 |
|||
#!/bin/bash |
|||
apache2 install |
|||
IPS=$(ifconfig | awk '/inet/ { print $2 }' | awk -F ":" '{ print $2 }') |
|||
apache2-common install |
|||
apache2-mpm-worker install |
|||
apache2-utils install |
|||
geist:/home/mutante# dpkg -L apache2 |
|||
NUMIPS=$(echo $IPS | wc -w) |
|||
/. |
|||
/usr |
|||
/usr/share |
|||
/usr/share/doc |
|||
/usr/share/doc/apache2 |
|||
/usr/share/doc/apache2/copyright |
|||
/usr/share/doc/apache2/changelog.Debian.gz |
|||
COUNT=1 |
|||
for i in $IPS |
|||
do |
|||
export IP$COUNT=$i |
|||
COUNT=`expr $COUNT + 1` |
|||
done |
|||
# ----------------- |
|||
# I need to display all ips like this to user: |
|||
# |
|||
# 1. 123.123.123.123 |
|||
# 2. 22.22.22.22 |
|||
# 3. 32.32.32.222 |
|||
# |
|||
# Please choose which IP address to use: |
|||
# Prompt user here |
|||
</pre> |
|||
<pre> |
|||
#!/bin/bash |
|||
# IPS=$(ifconfig | awk '/inet/ { print $2 }' | awk -F ":" '{ print $2 }') |
|||
IPS="192.168.23.5 47.45.56.11 189.67.24.21" |
|||
count=1 |
|||
for IP in $IPS; |
|||
do |
|||
IP[$count]=$IP; |
|||
echo "Found IP $count - ${IP[count]}"; |
|||
count=`echo $count+1 | bc` |
|||
done |
|||
read -p "Which IP do you want to use? (number)" choice |
|||
IPCHOICE=${IP[$choice]} |
|||
echo "Your choice was $choice - Setting IP to $IPCHOICE " |
|||
# ifconfig ... |
|||
</pre> |
</pre> |
||
[[Category:Wiki]] |
|||
<- Solved, went to [[Bash Scripts]] |
|||
[[Category:Internal]] |
|||
[[Category:IRC]] |
Latest revision as of 23:43, 22 March 2011
Feel free to use this as a pastebin for questions on IRC that are about scripting.
Content below should be (has been) copied to other permanent places after problem solved.
Free for new content now.
geist:/home/mutante# dpkg --get-selections | grep apache2 apache2 install apache2-common install apache2-mpm-worker install apache2-utils install geist:/home/mutante# dpkg -L apache2 /. /usr /usr/share /usr/share/doc /usr/share/doc/apache2 /usr/share/doc/apache2/copyright /usr/share/doc/apache2/changelog.Debian.gz