Function command persistent

General support questions including new installations
Post Reply
sandeeppowar
Posts: 15
Joined: 2015/09/23 14:16:41

Function command persistent

Post by sandeeppowar » 2015/12/09 16:35:06

Hi,

How to make function command persistent in Linux.

Regards,

Sandeep

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Function command persistent

Post by aks » 2015/12/09 17:56:34

Do you mean the function facility in bash?

sandeeppowar
Posts: 15
Joined: 2015/09/23 14:16:41

Re: Function command persistent

Post by sandeeppowar » 2015/12/10 11:18:52

Means after reboot it should be work.

Regards,

Sandeep Powar

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Function command persistent

Post by gerald_clark » 2015/12/10 12:22:07

What should work?
What is the real problem you are having?

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Function command persistent

Post by aks » 2015/12/10 17:47:24

I know what persistent means! What I don't understand is what function command?

sandeeppowar
Posts: 15
Joined: 2015/09/23 14:16:41

Re: Function command persistent

Post by sandeeppowar » 2015/12/15 16:07:07

for your reference Please find below example
function
[root@localhost ~]# hello () { echo "Hello,let's be friend" ; }
[root@localhost ~]# hello --> enter
Hello, let's be friend

I define hello with function () after hello --> enter i got Hello, let's be friend

but this is temporary after reboot hello command not give result Hello, let's be friend

I want to persistent function ()

Regards,

Sandeep

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Function command persistent

Post by aks » 2015/12/15 17:38:39

Okay, you mean the function facility that is available in various shells, I'll assume bash.
To make it persistent, put it in a script that executes upon login (like .bashrc or .bash_profile).
So define the function as you have at the command line in your (say) .bashrc. Logout/login (or reboot if you prefer) and test.

Post Reply