Re: rsync --delete
On Tue, Oct 20, 2020 at 08:32:12AM -0400, The Wanderer wrote:
> $ cat /tmp/test-function-script.sh
> #/bin/bash
>
> /home/wanderer/bin/abecedarian.sh
Incorrect shebang (missing the bang half). Therefore, the shell that
actually gets used is unpredictable. It depends on the caller.
If you call it *from* bash, then bash will be used. If you call it from
anything else, you'll probably get either /bin/sh or an error.
> $ function /home/wanderer/bin/abecedarian.sh { echo "nope"; }
> $ abecedarian.sh
> Usage: /home/wanderer/bin/abecedarian.sh /path/to/wordlist
> $ /home/wanderer/bin/abecedarian.sh
> nope
> $ /tmp/test-function-script.sh
> Usage: /home/wanderer/bin/abecedarian.sh /path/to/wordlist
>
> If I'm parsing that correctly, the full-path invocation from within the
> script doesn't seem to pick up the function definition from the outside
> session.
You also forgot to export the function.
Reply to: