Mailinglist Archive: opensuse (1264 mails)

< Previous Next >
[opensuse] Quick question: how to call a script function from "find"?
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Tue, 13 Jun 2017 00:52:47 +0200 (CEST)
  • Message-id: <nycvar.YFH.7.76.1706130047210.30027@Grypbagne.inyvabe>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Hi,

I have this script:

#!/bin/bash

function doall()
{
NOMBRE="$*"
echo $NOMBRE
}

find /home/cer/Fusion/Videos/ -type d -exec doall '{}' \;



But I get this error message:

find: ‘doall’: No such file or directory
find: ‘doall’: No such file or directory
find: ‘doall’: No such file or directory



It is not recognising that "doall" is a function in the same script; instead it tries to call an external command.

How can I do this?

(Yes, I did try looking 'man', did not seem to find whatever I need to find).

Of course, I can write it up in two scripts, but seems ugly.

- -- Cheers

Carlos E. R.
(from 42.2 x86_64 "Malachite" at Telcontar)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEUEARECAAYFAlk/G0cACgkQtTMYHG2NR9Wf8wCfe7LZDeVf2kuPme7BxzV1Ky+7
ttgAl267YI6l92xtDlFO6QE/78vks+4=
=fVjk
-----END PGP SIGNATURE-----
< Previous Next >
Follow Ups