lunedì 21 marzo 2011

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/

Nessun commento:

Posta un commento