in reply to Re^2: Calling Shell funtion in Perl script
in thread Calling Shell funtion in Perl script

This should work.

In . ~/.profil > /dev/null, is the missing e a typo that appears in your real code too?

Also the `` operator is calling /bin/sh, so if you are using a different shell (such as zsh), this may not work. Even if you are using bash, it may be invoked as sh and thus it is running in POSIX compatibility mode. You could try `set +o posix; . ~/.profile > /dev/null; whatever`

If the code still doesn't work, try this for debugging so that you see what commands the shell runs: my $result = `set -v; set +o posix; . ~/.profile > /dev/null; whatever`

Also, you might want to move the shell function from your profile to a separate shell script, so that you don't have to run the whole profile from our perl script. (You can still source the separate file from your profile.)