SCIENTIFIC-LINUX-USERS Archives

July 2014

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
ToddAndMargo <[log in to unmask]>
Reply To:
ToddAndMargo <[log in to unmask]>
Date:
Sun, 13 Jul 2014 02:41:10 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
On 07/13/2014 02:26 AM, ToddAndMargo wrote:
> Hi All,
>
> In bash script, I don't seem to be able to call a function
> from "find -exec".   What am I doing wrong?  (Google is of
> no help.)
>
> Many thanks,
> -T
>
> cat ./eraseme
> #!/bin/bash
>
> Test () {
>   echo "$1" | sed -e "s/\/home//"
> }
>
> Test "/home/CDs/Keepers/Linux/bash/grep_if_examples.txt"
> find /home/CDs/Keepers/Linux/bash -exec Test {}   \;
>
>
>
>
> $ ./eraseme
> /CDs/Keepers/Linux/bash/grep_if_examples.txt
> find: `Test': No such file or directory
>

Never mind.  I just figured it out.  "find" is
not a bash command.  It is an external command
and would know a thing about the internal
function.  Duh.

ATOM RSS1 RSS2