Monday, September 28, 2009

In Which I Confess that I am a Dumbass

I've known you could use source to hide your variables in a second file

% foo.conf
BASE=/opt/app/

% foo.sh
#!/bin/sh
source foo.conf
cat "$BASE"/file.txt


But I did not know until today you could also park functions there.

% foo.conf
BASE=/opt/app/

function type_file (){
     cat "$BASE"/file.txt
}

% foo.sh
#!/bin/sh
source foo.conf
type_file


How I make a living in IT I sometimes do not know.

blog comments powered by Disqus