Shell functions usage

Hi all,

I have a doubt..

If we create shell functions through a script itself, can we use the same functions in command line also..

for example:

$ cat a.sh
##### Functions

function system_info
{

}

function show_uptime
{

}

function drive_space
{

}

function home_space
{

}
$

then I executed this script and i want to use these functions in command line and as well as in other scripts also..
Can anyone please tell me that is it possible?

Thanks in advance..

Regards,
VRN

Source this function collection/library in your other scripts to make them available. For "using on command line" you might want to specify a bit more what you mean by that.

Yes,
to achieve this you need to source the script in the current shell using the dot (.) builtin:

. scriptname

If sourced properly, you should be able to re-use the code from within other scripts and or the (bash) shell (e.g. by sourcing your code from /etc/bashrc).

Thanks to all for valuble points, will give a try now..

Thanks again

Regards,
VRN