Very simple script
I use this command sometimes to quickly display an ip address of a host
host hostname | tail -c 15 Rather than typing this command in each time I thought about creating either an alias or a simple script. For example the alias would be called gh so all I would need to do is type gh [I]hostname[I] As simple as this sounds I dont know how to create/pass variables can any one help?? |
Try adding an entry into your .bashrc, in the alias section. alias gh="host <hostname> | tail -c 15".
After making the entry, give the command 'source .bashrc' to reload .bashrc and make the new alias active. |
Sorry buddy that didnt work
syntax error near unexpected token '|' |
in your .bashrc:
Code:
gethost() { Code:
gethost hostname |
Have you tried instead arrow up on the commmand line.
or Cover 'host | tail -c 15' by holding down the left mouse button and relocate to the command line then press the center (wheel) button. In a year I would forget what gh is if I don't add a full comment line in the script. |
All times are GMT -5. The time now is 08:11 AM. |