[plug] Bash scripting error with functions
Nick Bannon
nick at ucc.gu.uwa.edu.au
Sun Jun 12 20:25:29 WST 2005
On Sun, Jun 12, 2005 at 09:38:38PM +0930, Onno Benschop wrote:
> Can someone explain to me why the following script returns:
>
> xargs: make_file_link: No such file or directory
When /usr/bin/xargs runs, it's a new, separate program completely
separate from the context of your script. It can run other programs,
but it can't call functions in the script you called it from.
You could turn "make_file_link" into a two line executable script of its
very own, or (assuming no nasty filenames with newlines embedded) try this:
find "${source_dir}" -type f -print | while read F; do
make_file_link "$F"
done
Nick.
--
Nick Bannon | "I made this letter longer than usual because
nick-sig at rcpt.to | I lack the time to make it shorter." - Pascal
More information about the plug
mailing list