help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function in an executable file that can be sourced or executed


From: Mike McClain
Subject: function in an executable file that can be sourced or executed
Date: Sun, 5 May 2024 20:59:19 -0500

I have an executable file ~/bin/net that does the hocus pocus to bring
eth0 up and down. In another file, ~/bin/user.bash is a function, net(),
that does the same thing yet can be sourced.
Is there a way that I can put function net() in executable file ~/bin/net
with a call at the end like: [ if not sourced ] && net;
In other words, if ~/bin/net is called from the command line the
function will be executed?
Thanks,
Mike
--
I think we can say, and say with pride, that we have legislatures
that bring higher prices than any in the world.  - Mark Twain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]