title: How can I execute a bash function using sudo?
body: <p>I tried exporting the function and then executing it with bash, but that doesn't work: </p>
  
  <pre><code>$ export -f my_func
  $ sudo bash -c 'my_func' 
  bash: my_func: command not found
  </code></pre>
  
  <p>If I try to run the function with bash without sudo (bash -c 'my_func'), it works.</p>
  
  <p>Any idea?</p>