Using a function
Hello. I have found the syntax of the function and realised its importance in the ~/.bashrc file but I haven't found the way to use it. I just type it's name at the terminal's prompt but I get an error message. What shall I do? A simple example :
function today { echo "Today is `date`"} Then after logging on again I open the terminal window and type today. I get error. :) |
Can you please post the ~/.bashrc and show us how you invoke
(try to invoke) the function later on? It works for me ... Cheers, Tink |
u can just add this line
alias today='echo "Today is `date`"' to Your ~/.bashrc file and relogin and typing today will give u the proper result i'm not sure if this is what u wanted |
I simply add the " function today { echo "Today is `date`"} " line at the end of the ~/.bashrc file. My " alias " work perfectly in this way. Then after I log on again I type " today " in the terminal window. Thats all :)
p.s. Sorry for not copying here the code but I cannot use linux right now. polrus : yes i already did that but I am curious to find how functions work ;) Thank you anyway. |
Just get rid of the word function in front of your
function, then. ;} Cheers, Tink |
Oops! Was it so simple? I'll try it then! :D
|
Quote:
|
Code:
today(){ |
The problem is solved :) You rock Tinkster!
p.s.This is the exact form in order to work.... functionname() { commands.... } :cool: |
All times are GMT -5. The time now is 05:42 PM. |