manrique83
Programmer
I have a function "fnd" in my .profile file. I have shell script check.sh calling function "fnd" but it doesn't recognize the file unless I load the .profile file. I don't have to do this when referencing variables in my .profile file but can't get it to work without loading the file for my function. Is there a character I need to use to call a function similar to when I call variables ($)?
.profile
function fnd {
if [[ $# = 2 ]]; then
find $1 -type f -exec grep -l "$2" {} \;
fi
}
export env=system
check.sh
#!/bin/ksh -f
echo $env
fnd . function
$ ./check.sh
system
./check.sh[20]: fnd: not found
.profile
function fnd {
if [[ $# = 2 ]]; then
find $1 -type f -exec grep -l "$2" {} \;
fi
}
export env=system
check.sh
#!/bin/ksh -f
echo $env
fnd . function
$ ./check.sh
system
./check.sh[20]: fnd: not found