Compiler for c# code
sudo apt-get install mono-gmcs
than:
gmcs -o name_exe.estension code.cs
The World that i see
giovedì 24 marzo 2011
lunedì 21 marzo 2011
How to change MAC Address on ubuntu
Here a simple script
#!/bin/bash
echo "Mac change...Enter new mac: "
read mac
#a good idea is save your old mac address
ifconfig | grep HWaddr > .oldmac
ifconfig eth0 down
ifconfig eth0 hw ether $mac
ifconfig eth0 up
#!/bin/bash
echo "Mac change...Enter new mac: "
read mac
#a good idea is save your old mac address
ifconfig | grep HWaddr > .oldmac
ifconfig eth0 down
ifconfig eth0 hw ether $mac
ifconfig eth0 up
Send Mail Using bash shell!
To do this stuff you must install mutt ->
sudo apt-get install mutt
than create a new file and copy:
#!/bin/bash
#
#Require mutt
#check for installation - under construction
#folder=which mutt
#if [ "$folder" == '' ]; then
# echo "No mutt found"
#else
# echo "ok"
#exit
if [ -z "$3" ]; then
echo "#####################################################"
echo "Mutt shell usage."
echo "Usage: MailTO [Address] [MailObject] [Attachment y/n]"
echo "#####################################################"
exit
fi
echo "Enter Mail text: "
read text
echo $text > mail.txt
if [ "$3" == 'y' ]; then
echo "Specify attachment folder: "
read attachment
if [ -e $attachment ]; then
mutt -s $2 $1 -a $attachment < mail.txt
echo " "
echo "Mail send"
else
echo "$attachment doesn't exists"
fi
else
mutt -s $2 $1 < mail.txt
echo " "
echo "Mail send"
fi
data=$(date +%m%d%y)
if [ -d send ]; then
mv mail.txt send_mail/$data.$2
else
mkdir send_mail
mv mail.txt send_mail/$data.$2
fi
Finally...
chmod +x script_name
in sudo mode:
cp script_name /bin/
sudo apt-get install mutt
than create a new file and copy:
#!/bin/bash
#
#Require mutt
#check for installation - under construction
#folder=which mutt
#if [ "$folder" == '' ]; then
# echo "No mutt found"
#else
# echo "ok"
#exit
if [ -z "$3" ]; then
echo "#####################################################"
echo "Mutt shell usage."
echo "Usage: MailTO [Address] [MailObject] [Attachment y/n]"
echo "#####################################################"
exit
fi
echo "Enter Mail text: "
read text
echo $text > mail.txt
if [ "$3" == 'y' ]; then
echo "Specify attachment folder: "
read attachment
if [ -e $attachment ]; then
mutt -s $2 $1 -a $attachment < mail.txt
echo " "
echo "Mail send"
else
echo "$attachment doesn't exists"
fi
else
mutt -s $2 $1 < mail.txt
echo " "
echo "Mail send"
fi
data=$(date +%m%d%y)
if [ -d send ]; then
mv mail.txt send_mail/$data.$2
else
mkdir send_mail
mv mail.txt send_mail/$data.$2
fi
Finally...
chmod +x script_name
in sudo mode:
cp script_name /bin/
automatic alias add to bash
To automatize the adding of alias into your .bashrc without direct editing...
Create a new file and copy:
#!/bin/bash
if [ -z "$2" ]; then
echo "usage: ./addalias [AliasName] [Command]"
exit
fi
#for i in 'seq 1 50'
{
echo "alias $1='$2 $3 $4 $5 $6 $7 $8 $9'"
} >> .bashrc
restricted to max 9 arguments
than -> chmod +x script_name
cp script_name /bin/
Create a new file and copy:
#!/bin/bash
if [ -z "$2" ]; then
echo "usage: ./addalias [AliasName] [Command]"
exit
fi
#for i in 'seq 1 50'
{
echo "alias $1='$2 $3 $4 $5 $6 $7 $8 $9'"
} >> .bashrc
restricted to max 9 arguments
than -> chmod +x script_name
cp script_name /bin/
Get your external ip with bash
Here a little way....
to make the script:
edit a new file with an editor (for example gedit/nedit etc..)
#!/bin/bash
wget www.whatismyip.com/automation/n09230945.asp -O - -q
echo " "
than make it executable
chmod +x script_name
To make it available in all the place of your system: copy it into /bin/
to make the script:
edit a new file with an editor (for example gedit/nedit etc..)
#!/bin/bash
wget www.whatismyip.com/automation/n09230945.asp -O - -q
echo " "
than make it executable
chmod +x script_name
To make it available in all the place of your system: copy it into /bin/
Iscriviti a:
Post (Atom)